Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI everybody...

I need your help..

I'm new to crystal report. I'm doing a project in ASP.Net with c#.net as code behind. I want to create a report based on the dataset i created.

here the code i created.
C#
SqlConnection cnn;
       string connectionString = null;
       string sql = null;
       connectionString = "Data Source=localhost\\sqlexpress;Initial Catalog=HRMDB; Integrated Security=True";
       cnn = new SqlConnection(connectionString);
       cnn.Open();
       sql = "select * from SettingsUsers";
       SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
       DataSet ds = new DataSet();
       dscmd.Fill(ds, "SettingsUsers");

     objRpt.Load(Server.MapPath(@"CrystalReport1.rpt"));
     objRpt.SetDataSource(ds.Tables[0]);
     CrystalReportViewer1.ReportSource = objRpt;
     CrystalReportViewer1.DataBind();

In the design ..i created CrystalReportViewer1 and added a CrystalReport1.rpt in the project.

But I'm not getting the output...please help...
Posted
Updated 16-Jan-11 19:28pm
v2

Your code seems almost correct. Anyway do you get any error? Check the Crystal report event log.

For your information

Crystal reports in ASP.NET[^]

Crystal Report Blank / Empty / Not Displaying. No On-Screen Error, But Event Log ‘ConfigurationErrorsException’ Received[^]

Let us know.
 
Share this answer
 

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