Using scope_identity() without a stored procedure
Posted on 2012-03-29
Here is my SQL:
INSERT INTO MYTABLE (myvalue) VALUES ('test'); SELECT SCOPE_IDENTITY()
How can I execute this via classic ASP and get the identity of the table returned? Here is what I am trying now:
set conn = server.createobject("adodb.connection")
conn.CommandTimeout = 600
set record_set = connt.Execute(mysql)
myarray = record_set.getrows()
I get an error when running this - "Operation is not allowed when the object is closed." Is what I want to do even possible?
I realize that using a stored procedure would be best here; unfortunately I am unable to create stored procedures on the database I am working with (restriction at request of client). I am open to any other suggestions.