|
-
April 3rd, 2008, 05:08 PM
#1
Crystal Reports: How to change Oracle OLE DB server at runtime?
I'm using a rpt made with Crystal Reports 8.0.1 and VB 6. The report was made using the Microsoft OLE DB provider for Oracle. What I want
to do is change to Oracle server / database the report is connecting to at run time before the report is displayed. I am using
the Crystal Report Engine 8 Object Library (cpeaut32.dll), not the ocx.
After creating the report object:
Dim CrystalReport As CRPEAuto.Report
I open my report and discard saved data:
'Open The Report
Set CrystalReport = CrystalApplication.OpenReport(msReportSource)
CrystalReport.DiscardSavedData
Const sDBServer = "ORCL.SERVER" 'My TNS name for the Oracle Server
Const sDatabase = "ORCL.SERVER" 'I'm not sure what this value should be
Const sUID = "system"
Const sPwd = "manager"
I was then going to change the database connection one of two ways:
1:
Dim objDatabaseTable As CRPEAuto.DatabaseTable
For Each objDatabaseTable In CrystalReport.Database.Tables
Call objDatabaseTable.SetLogOnInfo(sDBServer, sDATABASE, sUID, sPWD)
If (Not objDatabaseTable.TestConnectivity) Then
Debug.Print "Database failed connection: " & objDatabaseTable.Name
End If
Next
Set objDatabaseTable = Nothing
2:
call crystalapplication.LogOnServer("pdsoledb.dll","MSDAORA.1",sDATABASE,sUID,sPWD)
Neither of these two way gets me a successful connection. What am I doing wrong, and which is the preferred method to use?
Thanks
Dean
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|