Get identity after INSERT using ADO

Get identity after INSERT using ADO

Post by Bojan Jurc » Thu, 16 Mar 2000 04:00:00



Hi!

How can I get an idetity field value back  after inserting a row into a
table using ADO?

Bojan

 
 
 

Get identity after INSERT using ADO

Post by Bojan Jurc » Thu, 16 Mar 2000 04:00:00


Never mind. I've already found the answer to this question. Thanks for
triing to help anyway.

 
 
 

Get identity after INSERT using ADO

Post by Constantin Dor » Thu, 16 Mar 2000 04:00:00


Tell us about it

>Never mind. I've already found the answer to this question. Thanks for
>triing to help anyway.

 
 
 

Get identity after INSERT using ADO

Post by Mark » Fri, 17 Mar 2000 04:00:00


Bookmark the new row before .update then return the bookmark, assuming your
using autonumber for your id field

> Hi!

> How can I get an idetity field value back  after inserting a row into a
> table using ADO?

> Bojan

 
 
 

Get identity after INSERT using ADO

Post by Bojan Jurc » Sat, 25 Mar 2000 04:00:00



> Tell us about it



Quote:> >Never mind. I've already found the answer to this question. Thanks for
> >triing to help anyway.

I'm sorry for not checkig this newsgroup for a while. Here is the example
code:

Dim r As New ADODB.Recordset

    On Error GoTo ErrorHandler

    queueConnection.Execute "INSERT INTO t_fw_queue (subscription_id,
fw_command) VALUES (0, '" + cmdText.Text + "')"

fw_command_id DESC", queueConnection
    commandID = r("Identity")
    r.Close

Bojan

 
 
 

1. Getting back identity after an insert via ADO?

If I have:

table point
(
 pt_ident integer identity not null,
 pt_x integer,
 pt_y integer
)

and I do:

insert point (pt_x, pt_y) values (0, 0)

How do I get the identity back programmatically? I've tried using ADO and
doing:


and the recordset I get back has a single field, and it's a NULL.

On the other hand, if I use isql_w, I can get back the proper value for the
identity.

How do people handle getting the identity back after an insert via ADO?
Thanks.

Chris Sells
http://www.sellsbrothers.com

2. Poor performance with UPPER 9.30uc2, aix

3. Getting Back Identity column value on Insert using RDS

4. Looking for PcFile or...

5. Getting SQL server Identity field using ADO

6. ADO connect to AS (please please comment)

7. Insert record specifying IDENTITY using ADO - Help!

8. Can't Start server (Internal NT Error 2140) HELP!

9. Insert vs AddNew - Getting Identity

10. Getting the last @@IDENTITY after cursor insert

11. Getting IDENTITY value BEFORE an insert(?!)