Changing database at runtime yields same data
Hi, I am using VB6 (code below), CR11, MSSQL 2000. When I change the database, data is still pointing to the 1st db and Save Data with Report is not checked. No subreport.
With crReport.Database
For i = 1 To .Tables.Count
.Tables(i).SetLogOnInfo g_Server, g_Database, g_User, g_Pwd
Next
End With
In CR11, if I open the report, do Verify Database and change the db there, it also doesn't work because data is still pointing to the old db. When I look at the properties in Set Database Location, the connection properties show Initial Catalog pointing at the new db but the table's properties show that the Catalog still pointing to the old db.
Please help. Thanks.
Re: Changing database at runtime yields same data
I have exactly the same problem... :(
Re: Changing database at runtime yields same data
Here is the answer !!!
Dim crxapplication As CRAXDRT.Application
Dim crxsubreport As CRAXDRT.Report
Dim crxDatabaseTable As CRAXDRT.DatabaseTable
Set crxapplication = CreateObject("crystalruntime.application.11")
Set crxreport = crxapplication.OpenReport(PathReports)
For Each crxDatabaseTable In crxreport.Database.Tables
crxDatabaseTable.ConnectionProperties("Initial Catalog") = g_Database
crxDatabaseTable.ConnectionProperties("Data Source") = g_Server
crxDatabaseTable.ConnectionProperties("Integrated Security") = True
crxDatabaseTable.Location = crxDatabaseTable.Location
Next crxDatabaseTable
Thanx to Experts Exchange :)