>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
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