0
votes

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 filelink.

1
Are you setting the DataSource property? - Brian M Stafford
@BrianMStafford thanks for respnse,yes,its working with table but this contain stored procedure so thats why not working - don
No matter where the data comes from you likely end up with a DataTable. Is that being attached to the DataSource property? I don't see this happening in your sample code. - Brian M Stafford
i don't know how to pass?Can you please help me - don

1 Answers

2
votes

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.