Click here to Skip to main content
15,886,258 members

Data does not show in Crystal Report viewer in run time

fahimeh.zarei asked:

Open original thread
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);   
}
Tags: C#, Windows Forms, CrystalReports, Reporting

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900