Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query VFP cursor and SQL server table
Message
From
27/02/2004 10:20:10
 
 
To
27/02/2004 08:54:35
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00881433
Message ID:
00881472
Views:
15
>Hi,
>I have a VFP cursor result contains customer records. I want to query all order transactions placed by these customers. How the sql statement look like to send to sql server?
>
>Thank you
hullo John -
assumptions - customers is local vfp cursor, with custid as primary key.
orders table is on ms-sql backend
here is some meta code .

lnhandle=sqlconnect(YourFavoriteDsn,'username','password)
*create empty table of order transactions, will use later
=sqlexec(lnhandle,"select * from orders where custid = 'ZZZZZZ'","cursEmpty")
select cursEmpty
copy to loc_orders && if fields to weird/long and get truncated use
[or]
use dbf("cursEmpty") again in 0 alias loc_orders
use in CursEmpty
select customers
scan
lcCustID = Custid
=sqlexec(lnhandle,"select * from orders where fkcustid = ?lcCustId","cursTrans")
insert into loc_orders from dbf("cursTrans")
endscan


now - this code is not complete, but you should get the idea ..
hth - mondo regards [Bill]
Previous
Reply
Map
View

Click here to load this message in the networking platform