Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 4-Jan-13 1:37am
v2

1 solution

Hi check your Reference Folder for the particular crdb_adoplus.dll file and also check the Namespace in Coding
 
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