I have a question regarding the return of an autonumber identifier to my object AFTER insert.
On my table, I am using a Generator and a Trigger to increment the to the next available integer for a unique id. The code for each is:
Generator:
CREATE GENERATOR INFOREQUEST;
SET GENERATOR INFOREQUEST TO 2;
Trigger:
CREATE TRIGGER INFOREQUEST FOR INFOREQUEST
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.INFOREQUESTID IS NULL) THEN NEW.INFOREQUESTID = GEN_ID(INFOREQUEST, 1);
END;
My Insert statement (defined through the use of a TableAdapter) obviously does not include the id column. My question is what mechanism do I use to return the ID to the DataSet?
I've read where you can include a Select statement on a reserved variable immediately after you Insert but I do not believe Firebird supports this. For example:
[Insert Statement]; Select ID, Name, State From TestInsert Where (ID = @@IDENTITY)
The only thing I can figure to do (also something I've read through other lists groups) is call a stored procedure that not only handles the insert, but also includes a Select at the end that returns the ID value.
Any thoughts?
----------------------------
Tony Kylitis
ReactorNet Technologies
P: 210-477-0200 Ext. 202
F: 210-223-2110
E: [EMAIL PROTECTED]
