//First step: Clear the previous data This. RptView.LocalReport.DataSources.Clear (); //Step Two: Specify the report pathT His. RptView.LocalReport.ReportPath ="REPORT2.RDLC"; //Step Three: Construct a new DataTableDataTable dt =NewDataTable ("DataTable1"); Dt. Columns.Add ("Name"); Dt. Columns.Add ("score"); Dt. Columns.Add ("Id"); Dt. Rows.Add (New Object[] {"language", the,"Y0001" }); Dt. Rows.Add (New Object[] {"Mathematics", the,"S0001" }); Dt. Rows.Add (New Object[] {"English", the,"E0001" }); //The name cannot be written incorrectly, and the dataset name in the report is the sameReportDataSource Rdsitem =NewReportDataSource ("DataSet1", DT); //There can be multiple data sources here This. RPTVIEW.LOCALREPORT.DATASOURCES.ADD (Rdsitem); //Fourth step: Construct ParametersList<reportparameter> Lstparameter =NewList<reportparameter>() { NewReportParameter ("Title", This. Txttitle.text),NewReportParameter ("Id", This. Txtid.text),NewReportParameter ("Name", This. txtName.Text),NewReportParameter (" Age", This. Txtage.text),NewReportParameter ("Sex", This. Txtsex.text),NewReportParameter ("Salary", This. Txtsalary.text),NewReportParameter ("Depart", This. Txtdepart.text)}; This. RptView.LocalReport.SetParameters (Lstparameter); This. Rptview.zoommode =zoommode.percent; This. rptview.zoompercent = -; //Fifth Step: Refresh the report This. Rptview.refreshreport ();
C#report Basic Operation Assignment