Click here to Skip to main content
15,905,322 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i have one employee table...in windows form
one textbox for emp_id after that when button click.i want create new report viewer for that emp_id ....


thanks
naveen
Posted

1 solution

//sample code to generate repotviewer


rptViewer.Reset();
            rptViewer.LocalReport.DataSources.Clear();
            commonObject.command1 = new SqlCommand();
            DataTable dt = new DataTable();

//to select details from database using sp to fill reportviewer
commonObject.command1.Parameters.AddWithValue("@CampusID", Session["CampusID"]);
           dt = commonObject.ExecuteProcedureSelect("SP_SchoolAddress");

           rptViewer.ProcessingMode = ProcessingMode.Local;
           rptViewer.LocalReport.Refresh();
           rptViewer.LocalReport.ReportPath = "Letter.rdlc";
           rptDataSource1 = new ReportDataSource("DatasetName", dt);
           rptDataSource = new ReportDataSource("Letter", dtDetails);
           rptViewer.LocalReport.DataSources.Clear();
           rptViewer.LocalReport.DataSources.Add(rptDataSource);
           rptViewer.LocalReport.DataSources.Add(rptDataSource1);
 
Share this answer
 
v3

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