Reputation: 55
I have made a Windows application using C# and crystal report and this is my code:
private void Form1_Load(object sender, EventArgs e)
{
CrystalReport1 objRpt = new CrystalReport1();
string connStr = "Data Source=.;Initial Catalog=Reg;Integrated Security=TRUE";
SqlConnection cn = new SqlConnection(connStr);
string query1 = "Select name,phone,mobile from Register";
SqlDataAdapter da = new SqlDataAdapter(query1, connStr);
DataSet ds = new DataSet();
da.Fill(ds, "my_dt");
if (ds.Tables[0].Rows.Count==0)
{
MessageBox.Show("mafeesh");
return;
}
objRpt.SetDataSource(ds);
crystalReportViewer1.ReportSource = objRpt;
}
When I run the program the following error occurs:
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.
Do you know why this might be the case?
Upvotes: 0
Views: 682
Reputation: 6971
Put this in your app.config file
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
Upvotes: 2
Reputation: 335
delete the dll files from Bin folder,and then build again your solution....i hope so far that this will help you
Upvotes: 0