Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# CrystalReports WinForm , +
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:
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
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 1-Dec-12 3:21am
Edited 1-Dec-12 3:28am
v2

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

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 184
0 OriginalGriff 7,630
1 Sergey Alexandrovich Kryukov 7,022
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,525


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2014
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