Introduction
When we developed web applications using .NET 2005 with an Oracle database there was a request from our customers. They wanted us to print reports with header and footer on each page, and convert the file to other file formats such as Excel. The requirement can be implemented using Crystal Reports in .NET 2005. This article is a note for us on how to develop reports using crystal reports in .NET 2005 with Oracle, and to deploy web site with crystal reports which took us much time, especially for deployment. Hopefully it can help you, and save you some time.
Develop Reports Using Crystal Reports in .NET 2005
Using Crystal Reports in Visual Studio .NET 2005 you can create very complex reports. We just give a simple case which connects to an Oracle database to retrieve data with a DataSet, and then show a web report using CrystalReportViewer.
1. Retrieve data to DataSet from a data source
OracleAccess oa = new OracleAccess(login, pwd, database);
DataSet ds = oa.Get_Data(id));
ds.Tables[0].TableName = "DTPrint";
For convenience in a demo, our code reads data to a dataset from an XML file: XMLFile.xml
<Employee Name="AAA" age="30" Sex="F" BirthDate="1/1/1960"></Employee>
<Employee Name="BBB" age="31" Sex="M" BirthDate="1/2/1960"></Employee>
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("App_Data/XMLFile.xml"));
ds.Tables[0].TableName = "DTEmployees";
2. Create DataSet DSEmployees.xsd for Available Data Sources
In the App_code directory, add DataSet DSEmployees.xsd. Crystal Reports will find this data source. Then add DataTable DTEmployees, and its columns (Name, Age, Sex, and BirthDate) in the DataSet.
3. Create Cristal Report: CREmployees.rpt
Add New Items | CrystalReport | Using the Report Wizard. In the window of Standard Report Creation Wizard, you can find the table DTEmployees from Project Data | ADO.NET DataSets | DSEmployees in Available Data Sources. Select this available data source DTEmployees.

4. Edit your crystal report
Add fields, header, footer, etc for this report.
5. Create a web page CRPage.aspx
Drag a CrystalReportViewer CRVEmployees. In Page_load event, load report, and assign it to reportsource of CRVEmployees.
ReportDocument rd;
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("App_Data/XMLFile.xml"));
ds.Tables[0].TableName = "DTEmployees";
rd = new ReportDocument();
rd.Load(Server.MapPath("CREmployees.rpt"));
rd.SetDataSource(ds);
CRVEmployees.ReportSource = rd;
CRVEmployees.DataBind();
6. View in Browser for CRPage.aspx
Following is what the report looks like.

Deploy Web Site Containing Crystal Reports for .NET 2005
There are many ways to deploy web site containing crystal reports for .NET 2005. We only explore following way that works.
1. Create a Web Setup Project for Deployment
On File menu, New | Project; In New Project window, select Other Project Types | Setup and Deployment, select Web Setup Project; Input project Name, location, and select Solution to Add to Solution;

2. Add Merge Module
In Solution Explorer, Right Click Project DeploymentTest, and select Add | Merge Module; Select CrystalReportsRedist2005_x86.msm;
Solution Explorer should look like:

If your Solution Explorer does not look like above, you will need to download CrystalReportsRedist2005_x86.msm [2]. Then copy it to the folder \Program Files\Common Files\Merge Modules. If microsoft_vc80_atl_x86.msm and policy_8_0_microsoft_vc80_atl_x86.msm aren�t there, you also need download and copy them. If they are still not in Detected Dependencies after adding merge module CrystalReportsRedist2005_x86.msm, you may need to uninstall your Visual Studio 2005. When reinstalling it, check boxes �Itanium Compilers and Tools� and �X64 Compilers and Tools�.

3. Add output files to the web setup project
In Solution Explorer, right click setup project DeploymentTest, Add | Project Output�; Select Content Files, leave Configuration to Active;

Click OK; Double Click item Content Files from � (Active) in Solution Explorer; In Properties window, set DefaultDocument as the start page for your web site (CRPage.aspx); VirtualDirectory property is set to the project name (DeploymentTest).
4. Build Web Setup Project
Select Setup project DeploymentTest; From Build Menu, select Build DeploymentTest.
5. Deploy Web Setup Project
Outside Visual Studio, go to your setup project directory, copy your setup project fold (DeploymentTest) to your remote web server; On your web server, double click your setup project DeploymentTest.msi to deploy your web site.
Go through all the steps which will deploy to your default web site C:\Inetpub\wwwroot\ DeploymentTest.
6. Create a virtual directory for web project
In your IIS Application Server Management console, create a virtual directory, which refer Content directory path to C:\Inetpub\wwwroot\ DeploymentTest; You also should check IIS server for ASP.NET version, Application pool. Also You should setup Documents | default content page to your start page (CRPage.aspx).
References
| You must Sign In to use this message board. |
|
|
 |
|
 |
Your article is good.
But my problem is, report is working fine in my development machine. After deploying in server, the report toolbar images are not displaying. It is showing in red color (X) mark. I tried in different ways.
With Merge Module and without merge module, I'm not able to show the toolbar images in server. What the problem will be? Can you help me in this matter?
Balasubramanian K.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
i cn not down load CrystalReportsRedist2005_x86.msm from Link. i request second way to run crystalreport or site free download CrystalReportsRedist2005_x86.msm 
|
| Sign In·View Thread·PermaLink | 1.63/5 |
|
|
|
 |
|
 |
i cn not down load CrystalReportsRedist2005_x86.msm from Link. i request second way to run crystalreport or site free download CrystalReportsRedist2005_x86.msm
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
|
 |
BO is aquired by SAP so updated link is https://www.sdn.sap.com/irj/scn/wiki?path=/display/BOBJ/Crystal+Reports+for+Visual+Studio+.NET+Runtime+Distribution++-++Versions+9.1+to+12.0
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi all, I m also use this term.it's running sucessfully. But i have generate the problem against it's size. my exe size is 3 mb and after setup design using CrystalReportsRedist2005 _x86.msm it's size is 30 mb aprox.
when i m download my software it's take a lot of time.
please help me for decresing the size of setup.
Thanks Anubhava Dimri 9250168195 anubhava.prodata@gmail.com
|
| Sign In·View Thread·PermaLink | 1.78/5 |
|
|
|
 |
|
 |
i want to select some field from data base in print all the record, but i really have problem with veriable which is used in form and i want to print that veriable values with database record......
name,marks,age from database => Crystal Reports (this is done by me) name,marks,age from database & variable str_amt from form1=> Crystal Reports
|
| Sign In·View Thread·PermaLink | 1.50/5 |
|
|
|
 |
|
 |
Suppose you want add a variable “test” (its value is “test_value”) to your report: 1. In the code of creating your report: yourReportDocument.SetParameterValue("test", "test_value"); 2. In your report: . Add a parameter "test" to "Parameter Fields" . Put this parameter to your report
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
h frnds
i have web application with store and retrive the data from the database in file.mdb in app_data folder.
it is working in developement.if i create websetup for this appcation i can only retrive the record ,i want to insert data in database.
similary i cant do file write,and copy
plz help me.
haja
hajaworld@yahoo.co.in
haja
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
i need the crystal report through codding.i have two date fields and one button. if click the button to display the details of those dates.please the send the step by step process.. my id is beebala@gmail.com bala
balamurugan.B
|
| Sign In·View Thread·PermaLink | 1.20/5 |
|
|
|
 |
|
 |
hi there,
how to deploy on a remote server when you do not have access to physical folder where you will be able to double click on the setup file?
|
| Sign In·View Thread·PermaLink | 1.67/5 |
|
|
|
 |
|
 |
I just wanted to say that this article save my ass! Trying to do this programicly has been a pain. Can you point me to your source of info? API calls, Methods, Properties? The documentation is light at best.
Thank you!!!!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi! I want to use custom business entities from a separate project containing classes (business classes) that implements ICollection Interface. Is it possible to use them for data retrieval instead of using dataset that is comparatively heavier and generates performance issues.
Regards, Jawad Munir
|
| Sign In·View Thread·PermaLink | 1.33/5 |
|
|
|
 |
|
 |
Thanks for sharing
I have lots of Crystal reports that have been designed to run against an MS-SQL Server. Now I want to run these same reports against a MYSQL Server…
Is there a way to change this at run time (through an API or any other way) with the need to maintain TWO versions of each report.
Hope someone can help me out here…
Cheers Alex
|
| Sign In·View Thread·PermaLink | 1.14/5 |
|
|
|
 |
|
 |
Great article Yunyou ! I'm not familiar with CR, I was wondering whether from the IE browser, a CR activeX was managing the report or if the report is made of html. Thanks, Marc
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Thanks. Sorry to response later. This is a real good question. I have no time to research it right now. What I understand is CR report is made of html prepared by CR engine in IIS server. It works very well in IE and Firefox.
|
| Sign In·View Thread·PermaLink | 1.20/5 |
|
|
|
 |
|
|