Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get Autoincrement value after insert

0 views
Skip to first unread message

Bruno Marotta

unread,
Sep 22, 2004, 12:54:19 PM9/22/04
to
Hi folks,

is there anyway do retrieve the value of a Autoincrement field after
using the Execute command of the TDatabase without opening a table or a
query ?

Thanks,

Bruno

Brian Bushay TeamB

unread,
Sep 22, 2004, 11:34:39 PM9/22/04
to

>is there anyway do retrieve the value of a Autoincrement field after
>using the Execute command of the TDatabase without opening a table or a
>query ?

That depends on what database you are using.
--
Brian Bushay (TeamB)
Bbu...@NMPLS.com

Bruno Marotta

unread,
Sep 23, 2004, 9:15:27 AM9/23/04
to
Paradox

Brian Bushay TeamB

unread,
Sep 23, 2004, 7:51:13 PM9/23/04
to
There is no support in Paradox in paradox for that

>Paradox
>
>Brian Bushay TeamB wrote:
>>>is there anyway do retrieve the value of a Autoincrement field after
>>>using the Execute command of the TDatabase without opening a table or a
>>>query ?

--
Brian Bushay (TeamB)
Bbu...@NMPLS.com

Bruno Marotta

unread,
Sep 24, 2004, 8:29:22 AM9/24/04
to
Thanks anyway

Mario *LigH* Rohkrämer

unread,
Oct 27, 2004, 5:53:00 AM10/27/04
to

"Bruno Marotta" <bmar...@riosoft.softex.br> schrieb im Newsbeitrag
news:4151...@newsgroups.borland.com...

Similar problem for me; but I'm using Sybase Adaptive Server Anywhere 9.

I wonder if it is possible to create a construct like

"SELECT Table.IDRow FROM (INSERT INTO Table (Rows) VALUES (Values))"

if not even executing the INSERT command using an ADOQuery might work.


Mario *LigH* Rohkrämer

unread,
Oct 27, 2004, 11:57:34 AM10/27/04
to
Answering myself... ;)

a) If the table contains an auto-increment field, and the database server
inserts values always increasing, you may

- INSERT
- SELECT {TOP 1 | FIRST} ... ORDER BY ID DESC

b) If the server supports trigger, you may trigger the creation of datasets
and send the new ID value somewhere...

The InterBase/FireBird manual contains a similar approach because
auto-increment fields must be implemented using "generators" there.


"Mario *LigH* Rohkrämer" <m.rohk...@true-professionals.de> schrieb im
Newsbeitrag news:417f...@newsgroups.borland.com...

0 new messages