Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to execute more than 1 update with SQLEXE
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01522041
Message ID:
01522044
Vues:
56
>Hi,
>
>How do you string two or more UPDATE commands to be executed with SQLEXEC()? I tried separating them with ";" but I get error message. Here is my test string:
>
>
>cCommand = "update MyTable set Field1 = '111' where Field1 = '222'; update MyTable set Field2 = '111' where Field2= '222'"
>SQLEXEC( nHandle, cCommand )
>
>
>What is wrong with the above syntax? TIA.

Try using this
TEXT to lcSQL NOSHOW
   UPDATE myTable SET Field1 = '111' WHERE Field1 = '222';
   UPDATE myTable SET Field2 = '111' WHERE Field2 = '222';
ENDTEXT

if SQLEXEC(nHandle, m.lcSQL) <0 
   &&Check the actual error with aerror()
ENDIF
I think your code was OK also, but better to write them as separate lines and you should always check the return value of SQLExec.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform