Click here to Skip to main content
15,746,534 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends

The following is my code for get report using rdlc report.

I have a web form with reportviewer and the in a button click i sent a casenumber to storeprocedure but i can't get the result of the stored procedure

in button_click event of the report page

string casenumber = textBox1.Text;
            ReportParameter[] rp = new ReportParameter[1];
            rp[0] = new ReportParameter("CaseNumber", casenumber);


and bind the datasource by selecting the datasource of the reportviewer control.

and the result is only show the design of report page. no data available in report.
Updated 1-Aug-14 9:18am
Jignesh Khant 2-Aug-14 0:59am    
The code you have written is for setting report parameter & not for setting report datasource.

1 solution

Here is the code to bind the Report Viewer using the Stored Procedure and Data Set

// Get the data table using stored procedure.
SqlCommand cmd = new SqlCommand("GetEmployeeDetailsList", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();

// Initialize the Report Data Source.
// DataSet1 -- Name of the Data Set created
ReportDataSource rds = new ReportDataSource("DataSet1", dt);

// bind datatable to report viewer
ReportViewer1.ProcessingMode = ProcessingMode.Local;
// Path to your rdlc file.
ReportViewer1.LocalReport.ReportPath = Server.MapPath("/EmpReport.rdlc");
// Name of your rdlc file.
ReportViewer1.LocalReport.ReportEmbeddedResource = "EmpReport.rdlc";

you can refer to below link for more details.

bind datatable to rdlc and reportviewer
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900