
crystal reports and how to change the database name
Hello:
I created a report called tmp.rpt, connected to a ORACLE ODBC source.
I was able to pullup the report.
I then made the report come up in VB successfully. I used the
following code snippet to do.
Set CrystalApplication = New CRAXDRT.Application
Set smryReport = CrystalApplication.OpenReport("E:\tmp.rpt")
Set dtlReport = CrystalApplication.OpenReport("E:\tmp.rpt")
'dsn, service, usr, pass
smryReport.Database.Tables(1).SetLogOnInfo "WI_DATA", "PDO", "aaa",
"bbb"
smryReport.Database.Verify
smryReport.DiscardSavedData
Set CrystalPageEngine = smryReport.PageEngine
smryReport.ReadRecords
<================================================>
I then created a different DSN, called WI_RPTS, but this time to a
DB2 database.
I modified the VB code to the following lines, so that it can connect
to the DB2 database. The following code is not working
Set CrystalApplication = New CRAXDRT.Application
Set CrystalReport = CrystalApplication.OpenReport("E:\tmp.rpt")
CrystalReport.Database.Tables(1).SetLogOnInfo "MA04.PKMS.COM",
"WI_RPTS", "abc", "def" CrystalReport.Database.Verify<----------->
CrystalReport.DiscardSavedData
Set CrystalPageEngine = CrystalReport.PageEngine
CrystalReport.ReadRecords
The database verification in the line above which says verify, works
fine.
But the readrecords line does not and gives me the following error.
Run-time error '-2147192184 (80047288)':
Server has not yet been opened.
I dont know what could be wrong, the crystal application is not
able to connect to the DB2 database, but works fine with ORACLE.
Do I have to change the rpt file each time I deploy the application at
different client site
Thanks for your time
-Narahari.