Click here to Skip to main content
11,431,171 members (70,482 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
hi friends,

This is my code for crystal report.

  int rollno = Convert.ToInt32(textBox1.Text);
            CrystalReport1 report = new CrystalReport1();
            DataSet1 data = new DataSet1();
            System.Data.SqlClient.SqlConnection sqlcon;
             string config   = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
             sqlcon = new System.Data.SqlClient.SqlConnection(config);
             System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("sp_getstudentforsearchbyrollno", sqlcon);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@rollno",rollno);
            System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd);
            da.Fill(data, "DataTable1");
            report.SetDataSource(data);
            crystalReportViewer1.ReportSource = report;

error in the line of
 report.SetDataSource(data);

this is my error.
Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
but normal crystal report works fine. the working crystal report code is below
//ReportDocument cryrpt = new ReportDocument();
            //cryrpt.Load("D:\\baskaran/crysexample/crysexample/CrystalReport1.rpt");
            //crystalReportViewer1.ReportSource = cryrpt;
            //crystalReportViewer1.Refresh();
how can solve this error
Posted 4-Jan-13 2:15am
Edited 4-Jan-13 2:37am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi check your Reference Folder for the particular crdb_adoplus.dll file and also check the Namespace in Coding
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150428.2 | Last Updated 4 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100