Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I wrote program in C# winform that uses Crystal Report.
I wrote this code for it and I trace it all of them.
I understand that my data source fills correctly in code behind (via breakpoint)., but when I run program, nothing is shown in the form.

FrmReport:
C#
public void test(string begDate, string endDate, string begHour, string endHour, string begMin, string endMin, int report_type)
    {
        parkResalt = srv.ReportParking(begDate, endDate, begHour, endHour, begMin, endMin, report_type);
        xsdReport xsdrep = new xsdReport();
        foreach (Parking_Services.ReportParkingResult rpr in parkResalt)
        {
            xsdrep.Tables["dtReportParking"].Rows.Add(rpr.Total_car, rpr.Total_Settlement, rpr.Shamsi_Date, rpr.rank);
        }

        System.Globalization.PersianCalendar Pc = new System.Globalization.PersianCalendar();
        rep.SetDataSource(xsdrep);
        rep.SetParameterValue("BegDate", begDate);
        rep.SetParameterValue("ToDate", endDate);
        rep.SetParameterValue("Date", Pc.GetYear(DateTime.Now) + "/" + Pc.GetMonth(DateTime.Now) + "/ " + Pc.GetDayOfMonth(DateTime.Now));
        CrystalReportViewer rptViewer = new CrystalReportViewer();
        rptViewer.DisplayStatusBar = false;
        rptViewer.ReportSource = rep;
        this.Show();
        } 
Report.cs
C#
public void callmethod(string begDate, string endDate, string begHour, string endHour, string begMin, string endMin, int report_type)
        {
            this.frmrpt.test(begDate, endDate, begHour, endHour, begMin, endMin, report_type);
        }
private void BtnReport_Click(object sender, EventArgs e)
        {
            Parking_Services.Service1 srv = new Parking_Services.Service1();
            System.Globalization.PersianCalendar Pc = new System.Globalization.PersianCalendar();
            string p = txt_from_date.FADatePicker.Text;
            string d = txt_to_date.FADatePicker.Text;
            createfrmreport();
            callmethod(p,d, txt_beg_h.Text, txt_to_h.Text, txt_beg_m.Text, txt_to_m.Text, cmb_Report.SelectedIndex);   
}
Posted
Updated 1-Dec-12 2:28am
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