Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use variable in Sqlexe function
Message
 
À
21/09/2010 04:38:07
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01482112
Message ID:
01482113
Vues:
74
>Hi,
>I want to insert some records from VFP to SQL Server 2005,
>I run the SQLEXEC to insert the record,
>I don't want to hardcode the values, how can I change the values to variables ?
>
>
>
>SQLEXEC(m.lnConn, "INSERT INTO CUSMAS(client_no, client_name, client_addr)  VALUES ('C001','Client A','156 ABC Street, HK')")
>
>
>
>
>Please advise.
>
>Thanks.
>Derek

Use parameters:
lcClientNo   = 'C001'
lcClientName = 'Client A'
lcClientAddr = '156 ABC Street, HK'

SQLEXEC(m.lnConn, "INSERT INTO CUSMAS(client_no, client_name, client_addr)  VALUES (?m.lcClientNo,?m.lcClientName,?m.lcClientAddr)")
And ALWAYS check the result from SQL* functions and use AERROR() to see why some function didn't make it :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform