Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query VFP cursor and SQL server table
Message
De
27/02/2004 10:20:10
 
 
À
27/02/2004 08:54:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00881433
Message ID:
00881472
Vues:
16
>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]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform