Friday, October 3, 2008

Crystal report in

Basic steps needed to display a simple report in crystal

Step1: Create a web application project.

Step2: Add new item and select crystal report from the template. This adds a new RPT file in your solution explorer.

Step3: Double click on the RPT file click on Crystal reports field explorer. You should see the field explorer toolbar.

Step4: Right click on 'Database field’s on the field explorer ->then click on database expert ->Expand create new connection -> Expand OLE DB ADO -> Select Microsoft OLEDB provider for SQL Server (this depends on what kind of data you want to connect) -> Give the server credentials and Click finish and done.

Step5: Right click on 'Database fields' on the field explorer -> then click on the database expert -> Expand the server, database and select table which you want to add to the report.

Step6: Expand database fields -> table. Now you can drag and drop the fields on the report.

Step7: We now need to display the report on the ASPX page. For that we need the 'CrysalReportViewer' control. So we expand the crystal reports section of the toolbar and drag the component on the ASPX page.

Step8: Now we need to go to code behind and specify the report source. That's it now compile and run the project and you can see your report live in action.

No comments: