Is is possible to execute a single s*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