Subject | Retriving an auto-incrimented field after a DSQL insert |
---|---|
Author | hopemedmike |
Post date | 2004-09-03T18:01:32Z |
I am modifying a Delphi program in which I currently use Table
Objects to insert and edit tables. To make the program run faster, I
am choosing to instead use a DSQL object to do all of my inserts and
updates. However, in some cases I need to retrieve a field which is
auto-incrimented by a trigger and generator. Using the table object,
I simply grab the value from this field by typing
Number := FieldbyName('Number') after the Post command. Being as the
table object just inserted this record, the table object's active
pointer is still pointing at that record, and the number I am asking
for is right there. My question is, how do I retrieve the auto-
incrimented field, from the record I just inserted using the DSQL
component? Is it necessary to call a select statement right after the
execution of the DSQL insert statement to grab the field I need, or
is there some setting in the DSQL component that will allow me to
grab it right then and there?
Objects to insert and edit tables. To make the program run faster, I
am choosing to instead use a DSQL object to do all of my inserts and
updates. However, in some cases I need to retrieve a field which is
auto-incrimented by a trigger and generator. Using the table object,
I simply grab the value from this field by typing
Number := FieldbyName('Number') after the Post command. Being as the
table object just inserted this record, the table object's active
pointer is still pointing at that record, and the number I am asking
for is right there. My question is, how do I retrieve the auto-
incrimented field, from the record I just inserted using the DSQL
component? Is it necessary to call a select statement right after the
execution of the DSQL insert statement to grab the field I need, or
is there some setting in the DSQL component that will allow me to
grab it right then and there?