Hi:
I'm converting a system from DF to SQL backends, just working it out now for the first time. First, I changed a crystal report "Print Quote" to the correct source (the SQL database) and then I added code to my crystal report class in oninitializereport to use a (defined) source.... so I could switch the source as needed (test area/live area) etc.

PROBLEM: Runs fine on my development PC, and I can swap back and forth between 2 SQL database sources on the server just by changing the database name.
I ported this to the client's TEST area, plugged in the different server name, database source, and I get errors on each TABLE the report tries to access:
The database table "QUOTE" cannot be found. Proceed to remove this table from the report?" (It's a crystal error). It does this for every database table.

Here is the source I am using (from Hans VDL) that I got on this forum: So, I have no idea where to begin in trying to figure out a solution. Any ideas?

(These 2 properties I change depending on the workspace)
Property String psServerName public "APPLAUSE-HP\SQLEXPRESS"
Property String psDataBase public "DatabaseNameHere"

Procedure InitializeODBConnection Handle hoReport
Boolean bAttached
Handle hoConnectionProperties
Variant vConnectionProperties
String sTable
Integer iTableItem iTableCount
Handle[] hoTables
Handle hoDatabaseTable
Boolean bOk

Get TableObjects of hoReport to hoTables
Move (SizeOfArray(hoTables)) to iTableCount
For iTableItem from 0 to (iTableCount-1)
Get ComName of hoTables[iTableItem] to sTable
Get GetTableObjectByName of hoReport sTable to hoDatabaseTable
Move (hoDatabaseTable) to bOk
If bOk Begin
Get create U_cCrystalConnectionProperties to hoConnectionProperties
Get ComConnectionProperties of hoDatabaseTable to vConnectionProperties
Set pvcomObject of hoConnectionProperties to vConnectionProperties
Get IsComObjectCreated of hoConnectionProperties to bAttached

If (not(bAttached)) Begin
Error DFERR_CRYSTAL_REPORT "ConnectionProperties"
End
Send ComDeleteAll of hoConnectionProperties
Send ComAdd of hoConnectionProperties "Provider" "SQLOLEDB"
Send ComAdd of hoConnectionProperties "Data Source" (psServerName(Self)) // <-- You have to determine yourself
Send ComAdd of hoConnectionProperties "Initial Catalogue" (psDataBase(Self))
// Send ComAdd of hoConnectionProperties "User ID" (psUsername(Self))
// Send ComAdd of hoConnectionProperties "Password" (psPassWord(Self))
Send ComAdd of hoConnectionProperties "Integrated Security" 1

Send destroy of hoConnectionProperties
End
Loop
End_Procedure


Procedure DoInitializeODBConnection Handle hoReport // <---- Call this in OnInitializeReport
Integer iReportCount iReportItem
Handle[] SubReportArray
//
Send InitializeODBConnection hoReport
//
Get SubReportObjects of hoReport to SubReportArray
Move (SizeOfArray(SubReportArray)) to iReportCount
For iReportItem from 0 to (iReportCount-1)
If (SubReportArray[iReportItem]) Begin
Send InitializeODBConnection (SubReportArray[iReportItem])
End
Loop
End_Procedure

Thank you.......Click image for larger version. 

Name:	error.jpg 
Views:	153 
Size:	39.4 KB 
ID:	10143