Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Winforms report viewer rdlc won't load data

$
0
0

Hello all. I have a report that I'm trying to get working but it just isn't. The scenario is I'm passing variables from Form1 into the Report Viewer Form called Form2. I have declared three parameters of PatientID, StartDate & EndDate. When I fire up my debugger, it shows the values pass correctly from Form1 just fine. When the report loads, it shows no data at all. I suspect my parameters are not being populated properly. Here's my code from the Report Viewer form.

private void AllFoodValuesReport_Load (object sender, EventArgs e)
{
    ReportParameterCollection reportParms = new ReportParameterCollection();
    string date1 = dtpStartDate.Text.ToString();
    string date2 = dtpEndDate.Text.ToString();

    DateTime startday = Convert.ToDateTime(date1);
    DateTime endday = Convert.ToDateTime(date2);

    reportParms.Add(new ReportParameter("StartDate",  startday.ToShortDateString()));
    reportParms.Add(new ReportParameter("EndDate", endday.ToShortDateString()));
    reportParms.Add(new ReportParameter("PatientID", txtPatientID.Text.ToString()));
    this.reportViewer1.LocalReport.SetParameters(reportParms);
    this.reportViewer1.RefreshReport();
}


Microsoft Certified Professional


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>