title: Crystal Report Database Connection fails
body: <p>I'm implementing a Windows Form, and on a button click it should print a Report with CrystalReportViewer.
  I'm developing it in Visual Studio 2017, and in my machine are installed CR runtime both 32 and 64 bit.</p>
  
  <p>This is my code:</p>
  
  <pre><code>using CrystalDecisions.CrystalReports.Engine;
  using CrystalDecisions.ReportSource;
  using CrystalDecisions.Shared;
  
  ..............
  ..............
          ConnectionInfo crconnectioninfo = new ConnectionInfo();
          ReportDocument cryrpt = new ReportDocument();
          TableLogOnInfos crtablelogoninfos = new TableLogOnInfos();
          TableLogOnInfo crtablelogoninfo = new TableLogOnInfo();
  
          string path = "my//report//path.rpt";
          cryrpt.Load(path);
  
          Tables CrTables;
  
          crconnectioninfo.ServerName = "MyServerName";
          crconnectioninfo.DatabaseName = "MyDatabaseName";
          crconnectioninfo.UserID = "MyUserName";
          crconnectioninfo.Password = "MyPassword";
  
          CrTables = cryrpt.Database.Tables;
          foreach (Table crtable in CrTables)
          {
              crtablelogoninfo = crtable.LogOnInfo;
              crtablelogoninfo.ConnectionInfo = crconnectioninfo;
              crtable.ApplyLogOnInfo(crtablelogoninfo);
          }
  
          crystalReportViewer1.ReportSource = cryrpt;
  </code></pre>
  
  <p>It works fine on my machine, and some others.</p>
  
  <p>When i build it in release mode, and install the application to another machines, someone works and other not. The error is that the report can not connect to database. </p>
  
  <p>I tried to ping the server, and it is ok.</p>
  
  <p>Here is the Stack trace of the Exception:</p>
  
  <pre><code>Stack Trace:   in CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.GetLastPageNumber(RequestContext pRequestContext)
    in CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber(ReportPageRequestContext reqContext)
  
  Inner Source: rptcontrollers.dll
  
  HResult: 2147217393
  </code></pre>
  
  <p>In all machines are installed CRRuntime (the same i have on mine!).
  Maybe i miss some dependencies, but don't know wich.</p>
  
  <p>I noticed that it doesn't work on machines that have not Visual Studio installed. But i cannot install Visual studio on all PCs.</p>
  
  <p>I can't find a similar issue on the web.
  Any help would be appreciated.</p>
  
  <p>Thanks in advance.</p>