Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To Determine SQL ID
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01092510
Message ID:
01092660
Vues:
24
Hi Kevin,

I intentionally omitted IDENT_CURRENT because in multi-user environment it may return wrong IDENTITY value. To pe precise, it may return value from the record added by another user.


>Actually, SCOPE_IDENTITY pointed me to IDENT_CURRENT.
>
>I added IDENT_CURRENT to my SQL class, where I pass in the table name:
>
>
>** Form the query
>sQuery = "SELECT IDENT_CURRENT('" + ALLTRIM(sTableName) + "')"
>
>** Run the query
>iResult = SQLExec(.iConnHandle, sQuery, "last_id")
>
>** If the command completed successfully
>IF iResult > -1
>
>  ** Store the results to the return value
>  iRetVal = last_id.exp
>	
>  ** Close the last_id table
>  USE IN last_id
>
>ELSE
>
>  ** Call the routine to record the error info
>  ._GetErrorInfo()
>
>ENDIF
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform