Click here to Skip to main content
16,005,169 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hi how can i use crystal report in asp.net
please send me sample code
best regards
Posted

Just Use Below Code :

add three References first :
C#
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Reporting;


 protected void Page_Init(object sender, EventArgs e)
    {
        ReportDocument cr;
        String data = "SELECT * from tablename";
        SqlDataAdapter ad1 = new SqlDataAdapter(data, connection);
        DataSet ds1 = new DataSet();
        ad1.Fill(ds1);

        path = Server.MapPath("report1.rpt");
        cr = new ReportDocument();
        cr.Load(path);

        cr.SetDataSource(ds1.Tables[0]);
        CrystalReportViewer1.ReportSource = cr;

    }

this will help you if not please post it.
Enjoy.
 
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