I have been trying to browse a SQL Server database-based Crystal Reports version 8 with following Visual Basic code:
CrystalReport1.ReportFileName = "C:\Report1.rpt"
CrystalReport1.Destination = crptToWindow
CrystalReport1.DiscardSavedData = True
CrystalReport1.WindowState = crptMaximized
MsgBox "Ok!", vbInformation
CrystalReport1.Action = 1
I am using the Crystal Reports control. The database of the report is ODBC datasource connecting to SQL Server. Without DiscardSavedData this works, but it displays old data. With DiscardSavedData, I get the error message:
- Error 20599 Cannot open SQL Server.
How do I solve this problem?