Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL-Server HTML MySQL , +
I would like to try Crystal Reports for web applications.
I have done it with Windows application, but for Web application i don't know how to use naming and reference.
I am not able to get reference from system. I do have question like whether we will be able to do Crystal Reports in Web application only if we add some dll or not?
Whether we need to have vs2010 for adding Crystal Reports in web application?
So I am confused, not getting any idea.
If possible please try to give me some sample code with clear explanations.
I tried Googling, but its not enough to find an answers
Posted 30-Mar-12 23:09pm
Edited 31-Mar-12 0:02am
André Kraak at 31-Mar-12 5:03am
Edited question:
Formatted text/code
Removed unnecessary tags
Laxmikanta Pradhan at 10-Feb-14 5:06am
I have also a question that in my web application in 4.0 there is no such option for crystal report viewer. please give some idea.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This code is working in my web application try it.
rpt = new ReportDocument();
CrystalReportViewer1.Enabled = true;
string str = "rptInvoiceDetails.rpt";
DataTable dt = new DataTable();
string strConn = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
SqlConnection MyCon = new SqlConnection(strConn);
SqlDataAdapter adp = new SqlDataAdapter("ProcedureName", MyCon);
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.SelectCommand.Parameters.Add("@Param1", SqlDbType.Int).Value = ParamValue1;
adp.SelectCommand.Parameters.Add("@Param2", SqlDbType.Int).Value = ParamValue2;
adp.SelectCommand.Parameters.Add("@Param3", SqlDbType.Int).Value = ParamValue3;
adp.SelectCommand.Parameters.Add("@Param4", SqlDbType.Date).Value = ParamValue4;
rpt.SetDatabaseLogon(SqlUser, SqlPassword, SqlServer, SqlDatabase);
CrystalReportViewer1.ReportSource = rpt;
CrystalReportViewer1.Visible = true;
André Kraak at 31-Mar-12 5:03am
Edited solution:
Added pre tags
Joanna Teyew at 24-Apr-12 21:40pm
where is ParamValue from?
Member 11316802 at 18-Dec-14 9:13am
ReportDocument.Load Method causing it to fail and results in Invalid file name. I have also added permission to temp folder still it doesn't solve the problem.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

pashad at 6-Apr-12 0:24am
Links formatted
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

For Web Applications just go through the post posted by tarun, Refer this-
Generate a Report using Crystal Reports in Visual Studio 2010[^]
At the basic,you need to have Typed Dataset, A Report Viewer, Report document to display the Report...
Refer the above document, It will surely Help,
All the BestSmile | :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web02 | 2.8.150326.1 | Last Updated 6 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100