Click here to Skip to main content
15,916,846 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Please help me how can I create Crystal Report in web application.

Please help me.


Regards
Seema
Posted

Hi,
C#
string strDBConnection = "Data Source=Localhost;Initial Catalog=Employee;Persist Security Info=True;User ID=sa;Password=1";
       string strCommandText = "SELECT * FROM EMP";

       SqlConnection SConnection = new SqlConnection(strDBConnection);
       SqlCommand cmd = new SqlCommand(strCommandText, SConnection);
       SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(strCommandText, SConnection);
       DataSet ds = new DataSet();
       sqlDataAdapter.Fill(ds);
       ReportDocument rd = new ReportDocument();
       rd.Load(Server.MapPath("EmployeeDetail.rpt"));
       rd.Refresh();
       rd.SetDataSource(ds.Tables[0]);
       CrystalReportViewer1.ReportSource = rd;
       CrystalReportViewer1.DataBind();


Thanks,
Imdadhusen
 
Share this answer
 
Comments
Espen Harlinn 6-Feb-11 11:37am    
Seems like a reasonable answer, a 5
 
Share this answer
 
Comments
Espen Harlinn 6-Feb-11 11:36am    
Another excellent link, a 5

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