Report RDLC not showing data

浪尽此生 提交于 2019-12-11 16:44:00

问题


I have create a report rdlc and use report viewer to view this report .But data not showing,just table header shown. please help me to resolve this issue.

 ReportViewer1.LocalReport.ReportPath = "C:\Users\Dell\Documents\Visual Studio 2012\HRMS\NewHRMS\AllEmpProfiles.rdlc"
            Dim params(0) As Microsoft.Reporting.WinForms.ReportParameter
            params(0) = New Microsoft.Reporting.WinForms.ReportParameter("deptName", "Finance")
            Me.ReportViewer1.LocalReport.SetParameters(params)
            Me.ReportViewer1.RefreshReport()

Attached file.


回答1:


Here is sample code showing how I usually configure a report. The line you are missing is the DataSources.Add:

  ReportViewer1.LocalReport.ReportPath = "<your rdlc>"
  ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1", <your data>))
  ReportViewer1.LocalReport.SetParameters(New ReportParameter("deptName", "Finance"))
  ReportViewer1.RefreshReport()

"DataSet1" corresponds to a name inside your rdlc file.

<your data> corresponds to data that you provide. It can be a DataTable, IEnumerable, BindingSource, etc.



来源:https://stackoverflow.com/questions/47515189/report-rdlc-not-showing-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!