Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
private void button4_Click(object sender, EventArgs e)
        {
			Form3 frm = new Form3();
			
			DataSet1 myDataSet = new DataSet1();
			DataTable dataTable = myDataSet._myTable;
			 for (int i = 1; i <= n; i++)
                {

                    DataRow drow = dataTable.NewRow();
                    if (true)
                    {

                        drow["proid"] = "0001";
                        drow["proname"] = "data2";
                        drow["cost"] = "200";
                        drow["code"] = "0123";
                        drow["shopname"] = "Shop Name";
                    }
                    
                    dataTable.Rows.Add(drow);
                }
			ReportDataSource datasource = new ReportDataSource("mydata", (DataTable)dataTable) ;
            
            frm.reportViewer1.LocalReport.DataSources.Clear();
            frm.reportViewer1.LocalReport.DataSources.Add(datasource);
            frm.reportViewer1.RefreshReport();
			
            frm.Text = "reporting";
            frm.StartPosition = FormStartPosition.CenterScreen;
            frm.ShowDialog();
		}
<pre>

What I have tried:

data not show in the report viewer rdlc (c# )

https://2.bp.blogspot.com/-Cw76wxrVtM4/Wfv1tyTikTI/AAAAAAAAAqk/-WS3LidgkegsUuhvnDlw30hnM-oWCeKngCLcBGAs/s320/ppp.png
Posted
Updated 12-Nov-17 18:38pm
v2
Comments
Sibasisjena 3-Nov-17 2:00am    
Checked your code apart from the report issue, there is a if condition and that will always be executed. Please take necessary action.

if (true)
{

drow["proid"] = "0001";
drow["proname"] = "data2";
drow["cost"] = "200";
drow["code"] = "0123";
drow["shopname"] = "Shop Name";
}

1 solution

Set Report Path
try
{
Pl_Report ObjReport = new Pl_Report();
ObjReport.Ind = 1;
BlObjslipType.GetReportData(ObjReport);
ReportViewer2.ProcessingMode = ProcessingMode.Local;
ReportViewer2.LocalReport.ReportPath = Server.MapPath("Reports/ReportName.rdlc");
if (ObjReport.ds != null)
{
ReportDataSource datasource = new ReportDataSource("DataSet1", ObjReport.ds.Tables[0]);
ReportViewer2.LocalReport.DataSources.Clear();
ReportViewer2.LocalReport.DataSources.Add(datasource);

}
else
{
ReportViewer2.LocalReport.DataSources.Clear();
}

}
finally { }
 
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