draxous 0 Newbie Poster

I used below code to display some data using crystal report.i used separate dataSet() object and connected it to the crystal report setDataSourse.
There are no compile errors,but after running it gives me the error
"Load report failed".

plz help..

The code.

String ConnectionString = ConfigurationManager.ConnectionStrings[0].ConnectionString;
        SqlConnection con = new SqlConnection(ConnectionString);
        SqlCommand com = new SqlCommand();
        SqlDataAdapter da = new SqlDataAdapter();
        DataSet1 dataset = new DataSet1();
        com.Connection = con;
        com.CommandText = "Select * from tbl_test_ForumList";
        da.SelectCommand = com;
        try
        {


            con.Open();
            da.Fill(dataset, "Query");
        }

        finally
        {
            con.Close();

        }
      

        
        ReportDocument myrpt = new ReportDocument();
       // CrystalDecisions.CrystalReports.Engine.ReportDocument myrpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
        myrpt.Load(@"D:\ssp_vir\Forum5\Interfaces\Common\ExamResults\Results.rpt");
        myrpt.Database.Tables[0].SetDataSource(dataset);
        CrystalReportViewer1.ReportSource = myrpt;
        CrystalReportViewer1.DataBind();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.