我使用的是动态DataSet (NewDs),它与datatable(xtbl)连接,但报表查看器显示没有文本的行。这是我的代码,有问题吗?
Dim f4 As New Form4
Dim ds2 As New NewDS ***NewDS=Dataset
Dim xtbl As New DataTable
xtbl = CType(DgvEmp.DataSource, DataTable)
ds2.Reset
ds2.DataSetName = "newTable"
'xtbl.TableName = "DSxtbl"
ds2.Tables.Add(xtbl.Copy)
ds2.Tables(0).TableName="DT"
Dim rds As New ReportDataSource(ds2.Tables(0).TableName ,ds2.Tables(0) )
f4.reportViewer1.ProcessingMode = ProcessingMode.Local
f4.ReportViewer1.LocalReport.DataSources.Clear
f4.ReportViewer1.LocalReport.Refresh
f4.ReportViewer1.LocalReport.DataSources.Add(rds)
f4.ReportViewer1.LocalReport.ReportEmbeddedResource="EmployeeBouncer.Report2.rdlc"
f4.ReportViewer1.LocalReport.Refresh
f4.ReportViewer1.Refresh
f4.ReportViewer1.RefreshReport
f4.Show发布于 2021-08-30 17:25:18
尝试使用以下代码
Dim f4 As New Form4
Dim ds2 As New NewDS ***NewDS=Dataset
Dim xtbl As New DataTable
xtbl = CType(DgvEmp.DataSource, DataTable)
ds2.Tables.Add(xtbl)
f4.ReportViewer1.LocalReport.ReportEmbeddedResource="EmployeeBouncer.Report2.rdlc"
Dim rds As New ReportDataSource("dt",ds2.Tables(0)) // Dataset name "dt" should be same as in rdlc file.
f4.reportViewer1.ProcessingMode = ProcessingMode.Local
f4.ReportViewer1.LocalReport.DataSources.Clear
f4.ReportViewer1.LocalReport.DataSources.Add(rds)
f4.ReportViewer1.LocalReport.Refresh
f4.ReportViewer1.RefreshReport
~~~https://stackoverflow.com/questions/68955641
复制相似问题