locked
How to Add Dataset Datasource to a report RRS feed

  • Question

  • User120603341 posted

    Hello,

    I want to add a dataset to my crystal report as a datasource, i am completely a beginner to reporting and only know ABC of it. so pleazse tell me how to add that dataset with a stored procedure to a crystal report.

    Thursday, May 3, 2012 4:52 AM

Answers

  • User-836030956 posted

    Hi,

    Here is step

    i. open crystal report document

    ii. Field Explorer-> Create new connection->Database file-> Select your Type Dataset

    iii. now you have succesfully add database you can drag and drop fields in database and genrate report

    run time need to fill type dataset and call report in crystal report viewer show it will show you report

    here is code to open crystal report in webpage

                ReportDocument rptDoc = new ReportDocument();            
                rptDoc.Load(Server.MapPath("Report/BOL.rpt"));
                rptDoc.SetDataSource(DsPacklist);//DsPacklist is type dataset
                CrystalReportViewer1.ReportSource = rptDoc;
    
    

    Regards,

    Bhavik Solanki

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 3, 2012 6:54 AM
  • User2144922816 posted

    Before, you start, you must have to knowledge about database connection with ASP.Net application.

    First you have to Add New Crystal Report from Add New Item.

    After adding Crystel Report you need to Add CrystalReportViewer for Displaying Crystal Report on your Webpage.

    On the web page cod behind file you just add below code: -
          
           DT = RAdapter.Select();
            ReportDocument rpt = new ReportDocument();
            string path = Server.MapPath("CrystalReport.rpt");

            rpt.Load(path);
            rpt.SetDataSource((DataTable)DT);
            CrystalReportViewer1.ReportSource = rpt;

      Need more Detail go to  - Meera Academy

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 4, 2012 6:43 AM

All replies

  • User-836030956 posted

    Hi,

    Here is step

    i. open crystal report document

    ii. Field Explorer-> Create new connection->Database file-> Select your Type Dataset

    iii. now you have succesfully add database you can drag and drop fields in database and genrate report

    run time need to fill type dataset and call report in crystal report viewer show it will show you report

    here is code to open crystal report in webpage

                ReportDocument rptDoc = new ReportDocument();            
                rptDoc.Load(Server.MapPath("Report/BOL.rpt"));
                rptDoc.SetDataSource(DsPacklist);//DsPacklist is type dataset
                CrystalReportViewer1.ReportSource = rptDoc;
    
    

    Regards,

    Bhavik Solanki

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 3, 2012 6:54 AM
  • User2144922816 posted

    Before, you start, you must have to knowledge about database connection with ASP.Net application.

    First you have to Add New Crystal Report from Add New Item.

    After adding Crystel Report you need to Add CrystalReportViewer for Displaying Crystal Report on your Webpage.

    On the web page cod behind file you just add below code: -
          
           DT = RAdapter.Select();
            ReportDocument rpt = new ReportDocument();
            string path = Server.MapPath("CrystalReport.rpt");

            rpt.Load(path);
            rpt.SetDataSource((DataTable)DT);
            CrystalReportViewer1.ReportSource = rpt;

      Need more Detail go to  - Meera Academy

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 4, 2012 6:43 AM