Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CA - AutoRefresh
Message
De
09/09/2005 15:26:17
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
00955384
Message ID:
01048270
Vues:
33
>I'm doing some tests here and I find a problem.
>If I have two tables T1 and T2, and the table T1 fires a trigger that inserts a new row in T2, when you try to recovery @@identity, you get a wrong number.
>

Hi Rudolfo,

You can't use SELECT @@IDENTITY as an InsertCmdRefreshCmd in this scenario because it returns the last IDENTITY value generated for the connection. You can't use SELECT SCOPE_IDENTITY() either because ODBC driver executes parameterized command by means of sp_executesql procedure, which changes the scope. I believe the best way to deal with this scenario is to use stored procedure call for the InsertCmd and return IDENTITY value using an OUTPUT parameter or return value. See example in message #1007757.

Aleksey.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform