ASP.NET - crystal report error - Asked By sunil pandey on 25-Jan-12 01:06 AM

hi all.

i written this code for crystal report but getting assemblies GAC error
Error    11    The type 'CrystalDecisions.CrystalReports.Engine.ReportDocument' exists in both 'c:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\10.5.3700.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll' and 'c:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\13.0.2000.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll'    E:\sunil\Desktop\EPRS_Backup\Sollics Payroll\Admin\quotation.aspx.cs    16    5    E:\...\Sollics Payroll\
code is.....

public partial class Admin_Default2 : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection("Data Source=DEVELOPER1;Initial Catalog=PayrollFinal;User ID=sa;Password=sollics123");
    ReportDocument rpt = new ReportDocument();
    protected void Page_Load(object sender, EventArgs e)
    {
     
      DataSet3 ds3 = new DataSet3();
      DataTable dt = new DataTable();
      dt.TableName = "Crystal report quotation";
      dt = getallorder();
      ds3.Tables[0].Merge(dt);
      rpt.Load(Server.MapPath("quotation.rpt"));
      rpt.SetDataSource(ds3);
      CrystalReportViewer1.ReportSource = rpt;
    }
    public DataTable getallorder()
    {
      conn.Open();
      SqlCommand cmd = new SqlCommand("select * from MISReport",conn);
      SqlDataAdapter da = new SqlDataAdapter(cmd);
      DataTable dt1 = new DataTable();
      da.Fill(dt1);
      return dt1;
    }

Sreekumar P replied to sunil pandey on 25-Jan-12 01:09 AM
Hey,

It sounds like your application has references to both versions. Have you recently upgraded your project?

You need to make sure that your application is only referencing one version of CR.

Which version of Crystal Reports are you using? It looks like you have two versions installed.
no errors found in ur code....
smr replied to sunil pandey on 25-Jan-12 01:11 AM
hi

You need to install Crystal on the server using the provided msi for the vs2008 version...

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5\CRRedist2008_x86.msi

Installing this will add the required CR assemblies to the GAC. You should not add them to your app's bin folder.

Suchit shah replied to sunil pandey on 25-Jan-12 01:23 AM

Just go in to the web.config file and check for the crystal report refrence is added properly if there is a 2 different version you find there then just remove one version refrence because at a time to run the report you requried only one refrence