Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: reporting-services , +
Am using crystal report in Win Forms. The record values fill in to data table, but not shown in report document.
How can recover this one?. Here my code.
How can recover this one?
  Query = "Select StudentId, TypeofInome, CourseName, CourseFee, BookFee, Paid, Balance, BillNo, Total, Curdate from tblInc where BillNo  = '" + InvoiceNo + "'";
                    StrPath = AppDomain.CurrentDomain.BaseDirectory + "\\Report\\myCrystalRep.rpt";
                    ReportDocument ObjRepDoc1 = new ReportDocument();
                    SqlDa = new SqlDataAdapter(Query, SqlCon);
                    DataTable dt = new DataTable();
                    myCrystalRep myRep = new myCrystalRep();
                    myRep .SetDataSource(dt);
                    crystalReportViewer1.ReportSource = myRep ;
                    ObjRepDoc1.PrintToPrinter(NoofCopy, false, 0, 0);
Thanks in Advance
Posted 30-Mar-13 4:54am
Edited 31-Mar-13 2:04am
Prasad Khandekar at 30-Mar-13 15:19pm
Have a look at this CP article (

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The order of coding is wrong.
First you should load the report file & then assign the ReportDocument to CrystalReportViewer. So it should be like below.
crystalReportViewer1.ReportSource = ReportDocument1;
And there's no need for PrintToPrinter method in your code because you wanted only to view the report.

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

  Print Answers RSS
0 Maciej Los 475
1 OriginalGriff 425
2 Sascha Lefévre 289
3 CPallini 285
4 CHill60 260
0 Sergey Alexandrovich Kryukov 9,773
1 OriginalGriff 9,290
2 Peter Leow 5,137
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,036

Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 30 Oct 2013
Copyright © CodeProject, 1999-2015
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