• What is crystal report?• How to implement using crystal report
What is crystal report• Crystal Reports is a business intelligence application used to design and generate reports from a wide range of data sources.• Crystal Reports is the built-in report designing tool in Visual Studio .NET and it is fully integrated with windows and web applications.
How data transferred• Imagine we are using ADO .NET to get a subset of data from SQL Server and store it in a DataSet. Then we conduct the data from dataset to CrystalReportViewer object to be displayed.• SQL Server -> SQLConnection -> SQLDataAdaptor -> DataSet - > CrystalReportDocument -> CrystalReportViewer -> ASP .NET web page.• In .NET application Crystal Report Document reads the data from dataset, NOT directly from data provider and this is the key point to Crystal Report integration with .NET.
Crystal Report Advantages• major advantage of using crystal report for visual studio .NET are *Rapid report development *can extend it to complicated reports with interactive charts *can programmatically export the reports into widely used formats like .pdf,.doc,.xls,.html,and .rtf
Publish Content Into Crystal Report• ***There are 2 ways to publish content into Crystal 1. Pull Method 2. Push Method* Crystal Reports, like many other applications, connects to a database by way of a database driver, where each driver is designed to handle a specific database type or method of data access. With Crystal Reports, you can use one of two models of accessing data: "Pull" and "Push."
Pull Model• In this model, the report will connect to the database, using the parameters given to it a design time, to pull the data as needed.• In this mode, all of the work is done by the report: * connecting to the database and issuing the SQL commands; *These are all handled without any coding from the developer. *This is the default model of Crystal Reports.
Push Method• The push model involves code written by a developer that: * creates and calls a connection on the database, *executes the SQL commands, *creates a record set or dataset that matches the fields in the report, and then assigns the object to the report.This model also allows the shaping and filtering of data before it reaches the report.
• In next screen Expend your database objects in left pane and add the tables you want to use in right pane
• Then after next step view the field explore shown like this
• Now design the report , drag and fields from Database fields in field explorer and which you want to show in report and drop them in Section3(Details), and preview the report, it should look like show below.
Code Behind• Protected Sub Page_Load (ByVal sender As Object, ByVal e As EventArgs) Dim crystalReport As New ReportDocument() crystalReport.Load(Server.MapPath("CrystalReport.rpt")) crystalReport.SetDatabaseLogon ("amit", "password", "AMITSQLEXPRESS", "TestDB") CrystalReportViewer1.ReportSource = crystalReport End Sub
Disclaimer: This presentation is prepared by trainees of baabtra as a part ofmentoring program. This is not official document of baabtra – Mentoring Partnerbaabtra – Mentoring Partner is the mentoring division of baabte System Technologies Pvt. Ltd