This is very easy in fact, using SQL. Indeed, take a look at the following code:
DECLARE @li_Index INTEGER
INSERT INTO tab_MyTable
(Field_1,
Field_2)
VALUES
(@Field_1,
@Field_2)
SELECT @li_Index = @@IDENTITY
Now the SQL variable @li_Index value is set to the identity value used to insert the record into the table tab_MyTable. In fact, the SQL global variable @@IDENTITY always contains the last inserted identity for the session (do not be afraid of concurrent accesses).
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