0

I'm new to VB so please don't laugh too loudly at my coding skills :)

I have created a dataset (Dataset1) that pulls from 2 tables. The SQL on the table adapter joins the 2 tables. The table adapters all return data correctly. The data sources on the report viewer are:

 DataSet1_uaPowderCoat
 DataSet1_uaPowderCoatType

and they are both instantiated to their binding sources. There is a report parameter (Lot Num) that needs to filter the info in the report to data from one row.

Code in the form load event:

 Me.ReportViewer1.LocalReport.DataSources.Clear()
        Me.ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1_uaPowderCoat", uaPowderCoatTableAdapter.GetData()))
        Me.ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1_uaPowderCoatType", UaPowderCoatTypeTableAdapter.GetData()))
        Me.ReportViewer1.RefreshReport()

And in the report event:

  Dim params(0) As Microsoft.Reporting.WinForms.ReportParameter
        params(0) = New Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_0", Me.txtLotNumber.Text)

        ReportViewer1.LocalReport.SetParameters(params)
        Me.uaPowderCoatTableAdapter.FillByPCLotNbr(DataSet1.uaPowderCoat, me.txtLotNumber.Text)
        Me.ReportViewer1.RefreshReport()

Report Fields are: =Parameters!Report_Parameter_0.Value

=(Fields!PCStrength.Value)

The Parameter field works fine, but I can't get the rest of the fields to populate (just #error). I have researched and tried a ton of different things and if I get one thing fixed something else goes wrong. Can anyone help?

Thanks!!!

4

1 回答 1

0

我怀疑您在该字段中存在数据源绑定错误或语法错误。尝试以下方法之一:

  • 对于数据源绑定,请确保 bindingSource 和 DataSources 都连接到报表并且报表可以访问它们。下面是我绑定数据源的方式:

    this.bindingSource1.DataSource = somelist; this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("SomeDataTableName", (this.PointBindingSource)));

  • 另外,我注意到 和 中的 DataSet 名称DataSet1_uaPowderCoat不同FillByPCLotNbr(DataSet1.uaPowderCoat。那可能是错误?

  • 确保=Parameters!Report_Parameter_0.Value =(Fields!PCStrength.Value)语法正确。你错过了一个IFF声明吗?

于 2013-08-09T21:08:51.820 回答