Failed to Load database information in Crystal Report for Visual Studio

22,380

Solution 1

Add the <startup> code below code under the <configuration> element in your app.config

<startup useLegacyV2RuntimeActivationPolicy="true"></startup>

Solution 2

crdb_adoplus.dll was missing in my crystal report installation directory.

C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64

I have re-installed crystal report runtime with admin privilege then crdb_adoplus.dll is installed. And report is opening perfectly.

Web.config/App.config changing was not required in my case.

You can also review this link: https://answers.sap.com/questions/12948468/cr13-sp26-visual-studio-2019-setdatasource-error-o.html

Solution 3

This problem may appear in older versions of crruntimes. If you upgrade your version you must install the latest crruntime for your processor architecture (x86 or x64) and then you need to see if it works. If not I found that there are a number of missing files in this folder:"C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0"

It has to look like this. folder path

If you have the 13.0400 version DLL of crystal reports in your project this will be the solution of your problem.

read this documentation.

Solution 4

I faced the error "Failed to load database information" with Crystal Reports.

The reports work on my machine (as a developer and have Visual Studio installed), but don't work on the client's machine and show the listed error.

I fixed the error by doing the following:

  1. I built the project with platform x86.
  2. I installed both Crystal Runtime 64 and 32 bits on the client machine although the Windows platform of the client machine is x64.
  3. Make sure to restart the machine after each installation.

Doing these steps, solved the problem. Hope it helps you.

Share:
22,380
Paresh Dudhat
Author by

Paresh Dudhat

I am Paresh Dudhat..

Updated on May 11, 2022

Comments

  • Paresh Dudhat
    Paresh Dudhat almost 2 years

    I'm having an issue with Crystal Reports for VS2013. I have a windows application developed in VS2010 with CR.

    When I try to run it in VS 2013, I get the following exception:

    Failed to load database information.
    Error in File BillReport {E3FDAF36-9149-4F03-BCB6-EE66639AFFFB}.rpt:
    Failed to load database information.
       at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)
       at Stock_Maintanance.PrintBillReport.PrintBillReport_Load(Object sender, EventArgs e) in e:\perforce\DudhatTechnologies\Users\jay vadiya\Stock Maintanance\Release 0.1\Stock Maintanance\PrintBillReport.cs:line 86
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
       at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
       at System.Windows.Forms.Control.CreateHandle()
       at System.Windows.Forms.Form.CreateHandle()
       at System.Windows.Forms.Control.get_Handle()
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.Show()
       at Stock_Maintanance.PrintBill.btPrint_Click(Object sender, EventArgs e) in e:\perforce\DudhatTechnologies\Users\jay vadiya\Stock Maintanance\Release 0.1\Stock Maintanance\PrintBill.cs:line 717
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at Stock_Maintanance.Program.Main() in e:\perforce\DudhatTechnologies\Users\jay vadiya\Stock Maintanance\Release 0.1\Stock Maintanance\Program.cs:line 20
    

    Following is my code to load crystal report from XML dataset which is populated by OLEDB connection

    string sqlstr = "";
    sqlstr = "select * from billMaster where billid =  " + billId + " and merchantName = '" + merchantName + "' ";
    // DataSet ds = m1.selectData(sqlstr);
    
    cmd = new OleDbCommand(sqlstr, m1.ccon);
    if (m1.ccon.State == ConnectionState.Closed) {
        m1.ccon.Open();
    }
    OleDbDataAdapter da = new OleDbDataAdapter(sqlstr, m1.ccon);
    
    BillPrint bp = new BillPrint();
    
    // dr = cmd.ExecuteReader();
    da.Fill(bp.billMaster);
    sqlstr = "select srNo from billInfo where billId=" + billId + " order by srNo";
    DataSet dsTemp = m1.selectData(sqlstr);
    sqlstr = "select (srNo+1-" + dsTemp.Tables[0].Rows[0].ItemArray[0].ToString() + ") as srNo,billId,itemType,itemName,length,width,thickness,squareMeter,billRate,Qty,subTotal from billInfo where billId=" + billId;
    OleDbDataAdapter da1 = new OleDbDataAdapter(sqlstr, m1.ccon);
    // dr = cmd.ExecuteReader();
    da1.Fill(bp.billInfo);
    
    string path = "";
    path = Application.StartupPath + "\\reports\\BillReport.rpt";
    
    /* if (RateVisible == 1)
    {
        path = Application.StartupPath + "\\reports\\BillReport.rpt";
    }
    else if (RateVisible == 2)
    {
        path = Application.StartupPath + "\\reports\\BillReportWithoutRate.rpt";
    }*/
    //  MessageBox.Show(path);
    
    ReportDocument rd = new ReportDocument();
    rd.Load(path);
    rd.SetDataSource(bp);
    crv.ReportSource = rd;
    crv.RefreshReport();
    
  • tishantha
    tishantha over 7 years
    Thank you very much
  • Baqer Naqvi
    Baqer Naqvi about 7 years
    shukeria dost for your help.
  • bjan
    bjan over 6 years
  • Ahsan Naushad
    Ahsan Naushad over 2 years
    But this did not solved my issue. The line is already added there however. Now what?
  • Ahsan Naushad
    Ahsan Naushad over 2 years
    I need to know more about this, I am really stuck here on this part.