Why do I get “Database logon failed” in Crystal Reports when using .NET object as datasource?

后端 未结 12 2222
故里飘歌
故里飘歌 2020-12-29 14:45

I am creating a simple report using a .NET object from my project as datasource, using SetDatasource() method. However, when I run the report I get \"Database l

相关标签:
12条回答
  • 2020-12-29 15:09

    Please try, Right-Click on Report -> Database-> Verify Database.

    If dialog box appears, locate your DataSet .xsd file (e.g DataSet1.xsd) and Apply.

    My problem solved in this way.

    0 讨论(0)
  • 2020-12-29 15:10

    In my case i forget to set datasource to a datatable. something like this

    rpt.Database.Tables("Account").SetDataSource(CType(DataSource.Account, DataTable))

    0 讨论(0)
  • 2020-12-29 15:11

    I started getting this dialog popping up after I changed the name of the .NET object my reports were referring to. To get rid the dialog, I had to ensure that none of my report sections or fields referred to the old name of the .Net object which was easy to spot. The fix for me was using the rename function in the Database Expert for the report.

    0 讨论(0)
  • 2020-12-29 15:13

    I started getting the notorious "database logon failed" error on a Windows Server 2016 machine after the July 2018 windows server updates. The report ran fine in Visual Studio 2017 on my dev machine, but not in IIS on Windows Server 2016 in production.

    After a day of investigation, I installed the Microsoft OLE DB Driver for SQL Server on my development machine - https://docs.microsoft.com/en-us/sql/connect/oledb/oledb-driver-for-sql-server?view=sql-server-2017. I created a report connection in the Crystal report database expert using the MSOLEDBSQL provider. I had to install the Microsoft OLE DB Driver for SQL Server on the production Windows Server 2016 machine as well.

    It turns out Microsoft has decided to deprecate the Microsoft OLE DB Provider for SQL Server. This and the native client no longer seem to work with Crystal Reports.

    0 讨论(0)
  • 2020-12-29 15:13

    Use native client Connection Version 10.

    0 讨论(0)
  • 2020-12-29 15:16

    I hade the same problem and it was due to the fact that I accidentally added anoher DataTable with the same name.

    var ds = new OrderDetail();
    var dt = new OrderDetail.ResultDataTable();
    //fill dataset here
    ds.Tables.Add(dt);
    

    After setting that DataSet as datasource I got the login failed error when exporting the report.

    I then added a line to remove the DataTable before adding the new DataTable:

    ds.Tables.Remove(dt.TableName);
    
    0 讨论(0)
提交回复
热议问题