title: Crystal Reports: Error connecting to SQL server
body: <p>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:</p>
  
  <pre><code>    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);
      }
  </code></pre>
  
  <p>Here is the error that happens at this line:</p>
  
  <p>tbl.Location = tbl.Location.Substring(tbl.Location.LastIndexOf(".") + 1);</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>Note that the same database account is used to read the database and display info in the browser without any problem. </p>
  
  <p>How can I fix it?</p>