Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with SQL involving 2 DBCs
Message
From
18/03/2004 12:14:17
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Problem with SQL involving 2 DBCs
Miscellaneous
Thread ID:
00887579
Message ID:
00887579
Views:
57
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
Map
View

Click here to load this message in the networking platform