0% found this document useful (0 votes)
37 views3 pages

Unit 5 Crystal Reports

Crystal Reports is a business intelligence and reporting tool that allows users to design and generate reports from a variety of data sources. It provides a designer interface that allows for rapid report development with minimal coding. Reports can include interactive charts and be exported to common file formats. There are two methods for creating Crystal Reports - the pull method retrieves data directly from the data source while the push method writes code to connect to the data source and cache data in a dataset for the report to access. The code example demonstrates using Crystal Reports in an ASP.NET application by connecting to a SQL database, filling a dataset, loading a report file, and setting the dataset as the report's data source.

Uploaded by

Bavani Marimuthu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views3 pages

Unit 5 Crystal Reports

Crystal Reports is a business intelligence and reporting tool that allows users to design and generate reports from a variety of data sources. It provides a designer interface that allows for rapid report development with minimal coding. Reports can include interactive charts and be exported to common file formats. There are two methods for creating Crystal Reports - the pull method retrieves data directly from the data source while the push method writes code to connect to the data source and cache data in a dataset for the report to access. The code example demonstrates using Crystal Reports in an ASP.NET application by connecting to a SQL database, filling a dataset, loading a report file, and setting the dataset as the report's data source.

Uploaded by

Bavani Marimuthu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Unit 5

Crystal Reports
Reporting tool
Business intelligence application
Used to design and generate reports using data source
Purpose
Analysis
Read-only
Requires minimal code
Available as integrated feature of visual studio.NET
Rapid report development - designer interface eases coding work for the programmer
Complicated reports with interactive charts
Can interact with other controls - ASP.NET Web form
Can programmatically export the reports into widely used formats -.pdf, .doc, .xls, .html and .rtf

How do you create?


Two ways
Pull method
Push method

Pull method
Database driver directly retrieves the data from the data source
Does not require to write code for creating a connection and retrieving data from the data
source

Push method
Write code to connect to the data source & retrieve data
Data is cached in dataset
Multiple crystal reports accesses data

//code
using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Data.SqlClient;
usingCrystalDecisions.CrystalReports.Engine;

public partial class _Default : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
inti = Int32.Parse(TextBox1.Text);
SqlConnection Cn;
stringmyconnectionstring;
myconnectionstring = "Data Source=SERVER2;Initial Catalog=fordemo;User
ID=sa;Password=stella";
Cn = new SqlConnection(myconnectionstring);
Cn.Open();
string SQL = null;
SQL = "SELECT * FROM t1 where id=" + i;
// str = "select * from attnd where perc" + DropDownList1.SelectedItem.Text
SqlDataAdaptermyda = new SqlDataAdapter(SQL, Cn);
Cn.Close();
DataSet2 ds = new DataSet2();
myda.Fill(ds, "t1");
ReportDocumentrp = new ReportDocument();
rp.Load(Server.MapPath("~/CrystalReport.rpt"));
rp.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rp;
}}

Crystal report webconfig:::


<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler,
CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral,
PublicKeyToken=692fbea5521e1304,
Custom=null" />
<section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler"
/>*******INCLUDE THIS
</sectionGroup>
</sectionGroup>
<businessObjects>
<crystalReports>
<rptBuildProvider>
<add embedRptInResource="true" />
</rptBuildProvider>
<crystalReportViewer> ****************************************** INCLUDE
<add key="ResourceUri" value="/crystalreportviewers13" />*********** INCLUDE
</crystalReportViewer>***************************************** INCLUDE </crystalReports>
</businessObjects>

You might also like