title: Crystal Report with Subreport failing on Windows 7 x64
body: <p>I have a C# .NET WinForms application that uses Crystal Reports.
  Crystal reports run fine on both x32 and x64 systems with the exception of reports containing subreports.  Any report containing a subreport fails with the wonderful: <b>"Log on failed" at ...VerifyDatabase()</b> but only on x64 systems.</p>
  
  <p>I have seen and fixed this problem in the past by unchecking Verify Database on every print, making sure the no data is being saved with the report and ensuring the correct driver and connection methods are being used in the designer.  This problem is not going away and seems to only be affecting reports with subreports.</p>
  
  <p>All projects in the solution are set to build to x32.
  The x64 systems have the CR 32bit runtime installed.
  The SQL Native Client is also installed.</p>
  
  <p>I have tried many different combinations of report preparations steps like not verifying the database, not refreshing the report, verifying and not refreshing, refreshing and not verifying... it goes on and on.</p>
  
  <p>Here is the current preparation method being used:</p>
  
  <pre><code>    private T GetReport&lt;T&gt;() where T: ReportDocument, new()
      {
          var report = new T();
  
          var connectionStringBuilder
              = new SqlConnectionStringBuilder(this.ConnectionString);
  
          var connectionInfo = new ConnectionInfo
                                   {
                                       DatabaseName = connectionStringBuilder.InitialCatalog,
                                       UserID = connectionStringBuilder.UserID,
                                       Password = connectionStringBuilder.Password,
                                       ServerName = connectionStringBuilder.DataSource
                                   };
  
          Action&lt;ReportDocument, bool, bool&gt; setConnection = (document, verify, refresh) =&gt;
              {
                  document.DataSourceConnections.Clear();
  
                  document.DataSourceConnections[0].SetConnection(
                      connectionStringBuilder.DataSource,
                      connectionStringBuilder.InitialCatalog,
                      connectionStringBuilder.UserID,
                      connectionStringBuilder.Password
                      );
  
                  document.DataSourceConnections[0].IntegratedSecurity = false;
  
                  /*
                  foreach (Table table in document.Database.Tables)
                  {
                      var tableLogOnInfo = table.LogOnInfo;
                      tableLogOnInfo.ConnectionInfo = connectionInfo;
                      table.ApplyLogOnInfo(tableLogOnInfo);
                  }
                   * */
  
                  //document.SetDatabaseLogon(connectionInfo.UserID, connectionInfo.Password, connectionInfo.ServerName, connectionInfo.DatabaseName);
  
                  if (verify)
                      document.VerifyDatabase();
  
                  if (refresh)
                      document.Refresh();
              };
  
          for (var index = 0; index &lt; report.Subreports.Count; index++)
          {
              var subreportName = report.Subreports[index].Name;
              var subreport = report.OpenSubreport(subreportName);
  
              setConnection(subreport, false, false);
          }
  
          setConnection(report, true, true);
  
          return report;
      }
  </code></pre>
  
  <p><strong>SOLVED: I have gotten the report to work. I am not sure what part of this solution actually solved the problem but these are the steps I took.</strong></p>
  
  <ol>
  <li>I checked the data source per aMazing's suggestion below. (It was already OLE DB)</li>
  <li>I removed all referenced to Crystal Reports in all projects in the solution.</li>
  <li>I re-added the Crystal Reports references and made sure all the references were the same version and made sure all references were set to 'Specific Version' = True.</li>
  <li>I set 'Copy Local' to True on the CR references on one project in the solution.</li>
  <li>I changed the call to the **setConnection** to not verify.</li>
  <li>I un-commented foreach table.ApplyLogOnInfo(tableLogOnInfo) section.</li>
  </ol>
  
  <p>I'm not sure why it works now but it does.  The table.ApplyLogOnInfo was un-commented in many of the permutations I tried earlier.  Maybe I never hit this specific combination... but I don't care at this point.</p>