How do you get the identity value of a row after an

but it returns 0 for all rows in the table. Thanks.

> How do you get the identity value of a row after an

> but it returns 0 for all rows in the table. Thanks.

Vic - you are best to use a JDBC 3.0 driver which includes the API's to > but it returns 0 for all rows in the table. Thanks.

retrieve the identity value. Please note that JDBC 3.0 does require JDK 1.4

or higher.

David Murphy

www.j-netdirect.com

: How do you get the identity value of a row after an

: but it returns 0 for all rows in the table. Thanks.

Silvio Bierman

1. Getting Identity Value on Insert

Is is possible to execute a single scrap of SQL (not a stored procedure)

that inserts a row and returns its identity.

For example: from SQL Query Analyzer I can execute:

And it returns:

(1 row(s) affected)

Identity

----------------------------------------

126

(1 row(s) affected)

If I attempt to execute the same SQL using an ADO command object, it appears

to execute correctly, but the resulting recordset is closed, so I can't get

the Identity value out of it:

adoCommand.commandText = "insert into TableX (test) values ("Blah")

As 'Identity'"

Set rs = adoCommmand.execute

now any action I take on the resulting recordset (rs) raises the error 3704:

The operation requested by the application is not allowed if the recordset

is closed.

Is there anyway to make this work?

Thanks

2. What is the difference between Ingres and Postgres?

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

5. Getting the value of an autoincrement or identity field during an sql insert

6. LPNMR'97: Final call for System Descriptions

7. Getting the value of an IDENTITY column after an INSERT query

8. Clearing results pane automatically

9. Getting auto-incremented identity value on insert...

10. Getting Back Identity column value on Insert using RDS

11. Getting IDENTITY value of a row that was just INSERTED

12. Getting the new identity value from an Insert query

13. Getting the value of an autoincrement or identity field during an sql insert

3 post • Page:**1** of **1**