Unit 5 Crystal Reports

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy