Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with SQL involving 2 DBCs
Message
De
18/03/2004 12:14:17
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Problem with SQL involving 2 DBCs
Divers
Thread ID:
00887579
Message ID:
00887579
Vues:
58
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform