General information
Title:
Problem with SQL involving 2 DBCs
Hello.
I'm using VFP8 and SQL Server 2000
I have DSNs for 2 DIFFERENT databases on the SQL Server.
I open each via SQLSTRINGCONNECT:
rsConnect1 = SQLSTRINGCONNECT('dsn=SQLDatabaseA;uid=myUserID;pwd=myPassword',lShared)
rsConnect2 = SQLSTRINGCONNECT('dsn=SQLDatabaseB;uid=myUserID;pwd=myPassword',lShared)
I create an SQL statement with a JOIN between a table in Database A, and a table in Database B.
and assign the string to the variable mQuest1
SELECT Abase.lname,Bbase.orderdate,Bbase.orderamount FROM tableA!Abase ;
LEFT OUTER JOIN tableB!Bbase ;
ON Abase.OrderNum = Bbase.OrderNum
= SQLPREPARE(rsConnect2,mQuest1)
= SQLEXEC(rsConnect1)
I get a SQL Error message stating Line 1: Incorrect syntax near '!'
If I remove the DBC reference (tableA!) I get the same error message.
If I remove the DBC reference (tableB!) I get this: Invalid object name: 'Bbase'
I tested the query code by creating the connections with Create Connection, created a Query that works fine,
and cut and pasted the Query code into my prg. It still crashes, so it's not the statement
but something about how I've opened or called the connections, I think......
Can someone please point out my error?
Thanks
David
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only