Error 20599 Cannot open SQL Server using VB6/Crystal report
<p>I have been trying to browse a SQL&nbsp;Server database-based <a href="http://en.wikipedia.org/wiki/Crystal_Reports" rel="nofollow noreferrer">Crystal Reports</a> version 8 with following Visual Basic code:</p>

<pre><code>CrystalReport1.ReportFileName = "C:\Report1.rpt"
CrystalReport1.Destination = crptToWindow
CrystalReport1.DiscardSavedData = True
CrystalReport1.WindowState = crptMaximized
MsgBox "Ok!", vbInformation
CrystalReport1.Action = 1
</code></pre>

<p>I am using the Crystal Reports control. The database of the report is <code>ODBC datasource</code> connecting to SQL&nbsp;Server. Without <code>DiscardSavedData</code> this works, but it displays old data. With <code>DiscardSavedData</code>, I get the error message:</p>

<blockquote>
  <ul>
  <li>Error 20599 Cannot open SQL Server.</li>
  </ul>
</blockquote>

<p>How do I solve this problem?</p>