Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I would like to try Crystal Reports for asp.net 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

Thanks
Regards
velu
Posted
Updated 30-Mar-12 23:02pm
v2
Comments
André Kraak 31-Mar-12 5:03am    
Edited question:
Formatted text/code
Removed unnecessary tags
Laxmikanta Pradhan 10-Feb-14 5:06am    
I have also a question that in my web application in asp.net 4.0 there is no such option for crystal report viewer. please give some idea.

This code is working in my web application try it.
C#
rpt = new ReportDocument();
CrystalReportViewer1.Enabled = true;
string str = "rptInvoiceDetails.rpt";
rpt.Load(Server.MapPath(str));

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;
adp.Fill(dt);

rpt.SetDatabaseLogon(SqlUser, SqlPassword, SqlServer, SqlDatabase);
rpt.SetDataSource(dt);
CrystalReportViewer1.ReportSource = rpt;
CrystalReportViewer1.Visible = true;
 
Share this answer
 
v2
Comments
André Kraak 31-Mar-12 5:03am    
Edited solution:
Added pre tags
Joanna Teyew 24-Apr-12 21:40pm    
where is ParamValue from?
Member 11316802 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.
 
Share this answer
 
v2
Comments
Prasad_Kulkarni 6-Apr-12 0:24am    
Links formatted
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 Best:-)
 
Share this answer
 
Comments
Member 11605049 25-Apr-15 3:09am    
in application use a crystal report but in that i want to pass a parameter to crystal report so tell me the solution

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900