Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>>I do an UPDATE command using SQLEXEC.
>>I *know* that the conditions specified (WHERE clause) cannot be matching, yet I seem to be getting a "1" back (updating only 1 record each call). The record is *NOT* being updated, which is what I want, but the return code is telling me to update a list that is shown to the user to indicate records updated.
>>
>>The Help says:
>>"Numeric data type.
>>SQLEXEC( ) returns the number of result sets if there is more than one. SQLEXEC( ) returns 0 if it is still executing and returns 1 when it has finished executing. SQLEXEC( ) returns –1 if a connection level error occurs.
>>
>>SO what does it return after an UPDATE command? I had guessed that it would return the number of records updated but that is obviously wrong.
>>
>>Thanks
>>Jim
>
>Jim,
>Take that "1" as command successfully finished executing w/o any errors.
>Update might finish successfully yet no records are updated (ie: no match to where clause). Just before update try a select with the same where to see if that's the reason.
Cetin (and Fabio),
That apparently is what I have to do... but I want(ed) to avoid an extra SELECT because this is run inside a MSCOMMCTL where timing is critical.
I had already specified that the SQLs (using VFP ODBC by the way) should be synchronous (and batchmode for insurance) and I had also limited my updates to single records to both make it fastest possible and provide possibility of clear return code.
With this limitation I wonder why so many people say SPT is the best way to do this stuff?
Anyway, thanks both of you
Jim
>Cetin
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement