On our machine (Windows Server 2012R2), we have an ASP.net website that uses Crystal Reports (2008) for some reports. The database is SQL Server 2014. Here is the code related to the error:
ConnectionInfo cnnInfo = new ConnectionInfo();
cnnInfo.ServerName = serverName;
cnnInfo.DatabaseName = dbName;
cnnInfo.UserID = userId;
cnnInfo.Password = password;
ReportDocument rd = new ReportDocument();
rd.Load(rptUrl);
RptViewer.ReportSource = rd;
CrystalDecisions.CrystalReports.Engine.Database rptDb = rd.Database;
TableLogOnInfo tblLogOnInfo = new TableLogOnInfo();
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in rptDb.Tables)
{
tblLogOnInfo = tbl.LogOnInfo;
tblLogOnInfo.ConnectionInfo = cnnInfo;
tbl.ApplyLogOnInfo(tblLogOnInfo);
tbl.Location = tbl.Location.Substring(tbl.Location.LastIndexOf(".") + 1);
}
Here is the error that happens at this line:
tbl.Location = tbl.Location.Substring(tbl.Location.LastIndexOf(".") + 1);
Logon failed.
Details: ADO Error Code: 0x
Source: Microsoft OLE DB Provider for SQL Server
Description: [DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error.
SQL State: 08001
Native Error: Error in File C:\Windows\TEMP\EventByEventTypeCrossTab {FC74CD56-B1FF-4B06-9566-B927D660617D}.rpt:
Unable to connect: incorrect log on parameters.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Logon failed.
Details: ADO Error Code: 0x
Source: Microsoft OLE DB Provider for SQL Server
Description: [DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error.
SQL State: 08001
Native Error: Error in File C:\Windows\TEMP\EventByEventTypeCrossTab {FC74CD56-B1FF-4B06-9566-B927D660617D}.rpt:
Unable to connect: incorrect log on parameters.
Note that the same database account is used to read the database and display info in the browser without any problem.
How can I fix it?