Click here to Skip to main content
11,490,003 members (61,182 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
hi,, I have a problem in the following code:
            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 24-Dec-12 21:56pm
Edited 25-Dec-12 1:10am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try:
  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[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.:

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
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 595
1 Andy Lanng 233
2 OriginalGriff 213
3 Maciej Los 170
4 _duDE_ 141
0 Sergey Alexandrovich Kryukov 9,608
1 OriginalGriff 8,475
2 Sascha Lefèvre 3,419
3 Maciej Los 3,106
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100