Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,, I have a problem in the following code:
C#
            this.reportViewer1.LocalReport.DataSources.Clear();
            DataTable dt = new DataTable(); 
SqlDataAdapter da = new SqlDataAdapter("select * from input", con);
           
            da.Fill(dt);

            Microsoft.Reporting.WinForms.ReportDataSource rprtDTSource = new Microsoft.Reporting.WinForms.ReportDataSource("input", dt);

            this.reportViewer1 .LocalReport.DataSources.Add(rprtDTSource);
            this.reportViewer1 .RefreshReport(); 

//it loads nothing in the report viewer, and when check the table dt it has a value ,, but can't be displayed,, please help
// I have only Report viewer on the design view
Posted
Updated 25-Dec-12 0:10am
v3

Try:
C#
ReportDataSource rds = new ReportDataSource("input", dt);

ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();


Please follow the below article:
Using Asp.Net Local Report (RDLC) in Web Applications[^]
 
Share this answer
 
thank you for your help but
still dosn't display any thing on the report viewer and dosn't give any error or exception,, am using windows app, and that was the code after I mofified it to yours.:

C#
Microsoft.Reporting.WinForms.ReportDataSource rds = new  Microsoft.Reporting.WinForms.ReportDataSource("input", dt);
            this.reportViewer1.LocalReport.ReportPath = "Report.rdlc";
            reportViewer1.LocalReport.DataSources.Clear();
            reportViewer1.LocalReport.DataSources.Add(rds);
            reportViewer1.LocalReport.Refresh(); 
//Report.rdlc is report that has all column of table input
 
Share this answer
 
v2

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