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

I am trying to display Report for my Windows application in VS 2015.
its on Button Click and have two DateTimePicker controls for selecting From and To dates.The Problem is that i don't encounter any error when running the application Although the selected from and to dates are getting displayed in the report but not the Data.


Below is the code

What I have tried:

C#
private void btnLoad_Click(object sender, EventArgs e)
       {

           MyDataSetTableAdapters.GetDataReportTableAdapter ta = new MyDataSetTableAdapters.GetDataReportTableAdapter();
           MyDataSet.GetDataReportDataTable dt = new MyDataSet.GetDataReportDataTable();
           ta.Fill(dt);
           ReportDataSource rds = new ReportDataSource();
           rds.Name = "DataSet1";
           rds.Value = dt;

           ReportParameter rp1 = new ReportParameter("fromDate", dtFromDate.Value.Date.ToShortDateString());
           ReportParameter rp2 = new ReportParameter("toDate", dtToDate.Value.Date.ToShortDateString());

           ReportViewer1.LocalReport.DataSources.Clear();
           ReportViewer1.LocalReport.ReportPath = "Report.rdlc";
           ReportViewer1.LocalReport.SetParameters(rp1);
           ReportViewer1.LocalReport.SetParameters(rp2);
           ReportViewer1.LocalReport.DataSources.Add(rds);
           ReportViewer1.LocalReport.Refresh();
           ReportViewer1.RefreshReport();

       }



Please Help what i am doing wrong here?
Posted
Updated 7-Apr-17 2:34am
Comments
CHill60 6-Apr-17 7:16am    
Sounds like nothing is being returned by the query. Put a breakpoint on ta.Fill(dt), step over the line and then examine the content of dt
Nazneen s 6-Apr-17 7:24am    
yes i did that its throwing NonImplementedException changed ta.Fill(dt,dtFromDate,dtToDate); getting The method or operation is not implemented. i googled about it and some say to comment it out or restart will fix it but nothing has worked for me so far.
CHill60 6-Apr-17 9:01am    
If you use the Reply link on a comment then the poster is notified that you have responded.
What is GetDataReportTableAdapter, I'm not familiar with it and it doesn't appear to be part of any commercial product. If it is your code then use the Improve question link to include that code.

1 solution

I Resolved The Issue by Creating new Stored Procedure and accessing data from it.

ta.Fill(dt,dtFromDate.Value.ToShortDateString(),dtToDate.Value.ToShortDateString());

this changes should be done while autobinding datasource to reportviewer.
 
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