报告既不显示也不显示任何错误
问题描述:
我试图在VS 2015中显示我的Windows应用程序的报告。
它的按钮点击并有两个DateTimePicker控件用于选择From和To日期。问题是我在运行应用程序时没有遇到任何错误虽然所选的from和to日期会显示在报告中而不是数据中。
以下是代码
我的尝试:
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:
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?
答
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.