Вы находитесь на странице: 1из 10

How to use Crystal Report in your project?

It was a problem to know how we can print our reports, but I tell you how. Studio .NET support crystal report and you can use it easily. Follow Me: 1. Create a new C#.NET or VB.NET windows application project. 2. With using .NET toolbox, design your project as such as this figure

3. You need a TextBox, a Button and a CrystalReportViewer objects in your project.

4. Be sure that your SQL Server connection is started, then connect to your SQL Server and use PUBS tables in your project. (If you have don't know how, I told you in my another article named "All you want in ADO.NET") 5. Now generate your dataset object. 6. Right click in your project name in the solution explorer and choose Add New Item, such as this figure.

7. Now find crystal report item and add it to your project.

8. After you do that, you must configure your report.

9. In the standard report creation wizard, select your dataset in the Project Data option. Select AUTHORS table and add it to selected table part.

10. In the next step, select the fields you want to print and add it to the right part and click at the FINISH button.

11. Form your TOOLBOX; choose the Report Document object from the Component part and apply its setting.

12. You are ready for coding your project. For Click Event of the button write these codes:
//Filling dataset with Authors table data. dataAdapter.Fill(myDataSet.authors); //Setting dataset tables to the crystal report document object. crystalReport11.SetDataSource(myDataSet.authors); //Telling to the report viewer, what is my report document. crystalReportViewer1.ReportSource = crystalReport11; //Or you can directly send your report to the printer with this line. //In this case , you don't need a ReportViewer in your project. /*crystalReport11.PrintToPrinter(1,true,0,1);*/

My vote of 5

niro shah

My vote of 1 yasar.facebook dfg Sign InView ThreadPermalink My vote of 1 augusto branquinho 8:44 18 Jun '10 Very basic Sign InView ThreadPermalink How to use Conditional Count function in crystal Muhammad Asim 19:41 7 Nov '09 report 8 ? Mughal my name is "Muhammad Asim Mughal"

18:29 9 Jun '11 Thank You Sign InView ThreadPer malink 20:15 23 Oct '10

i m from Pakistan i m working in crystal report 8 and facing a problem which is described below, i wan to count records of a field depending a specific condition. For example a field name is "{r_IndividualEmployee_AS.AttendanceStatus}" and it contains multiple records like "Present" "Casual Leave" "Emergency Leave" "Uninformed Leave" etc. Now i want to count the number of "Casual Leaves" in VB using the SQL query it is so simple like i just write the query, "Select count(AttandanceStatus) from table where AttandanceStatus = 'Casual Leave' in want to do the same above operation in crystal report. can you help me? Sign InView ThreadPermalink 2.00/5 (1 vote) parameters in crystal report gauravji4u 21:18 30 May '07 how can i pass parameters in crystal report. i want to pass values from two textboxs on form as parameters Sign InView ThreadPermalink 1.43/5 (13 votes) Re: parameters in crystal report amitmittal1521978 23:21 5 Jan '09 i had successfully open the parameter crystal report but when i export it it give me error Input string was not in a correct format ==================================================================== ============ Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:

[FormatException: Input string was not in a correct format.] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2755599 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +112 System.Int32.Parse(String s) +20 CrystalDecisions.Web.CrystalReportViewer.OnExport() +397 CrystalDecisions.Web.CrystalReportViewer.RaisePostBackEvent(String eventArgument) +79 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String

eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

-------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 ==================================================================== ==================================== Please explain me what to do?????????? Sign InView ThreadPermalink 2.00/5 (1 vote) good work Dali Hammadi 3:10 18 Mar '07 thunk you Sign InView ThreadPermalink 1.00/5 (1 vote) Thank You! Noah59 2:31 3 Dec '06 All I can say is thanks for your hard work. I didn't think to populate the dataset and my report was blank; I was banging my head against the wall, over and over and over again Then I found your article and now the data shows up on the report just like I wanted. Thanks again, Noah Sign InView ThreadPermalink How to use Crystal Report in your project Please send answer

Kithari 20:42 18 Sep '06

M.Manohar Sign InView ThreadPermalink 1.00/5 (7 votes) How to refresh datasets fkchong 0:11 28 Oct '05 Very good useful tutorial. I adding fields to table, so the datasets also change. I found out datasets of Crystal Report not updated. Sign InView ThreadPermalink 2.00/5 (6 votes) Last Visit: 19:00 31 Dec '99 Last Update: 23:11 27 Aug '11

12 Next