I want to be able to insert a row into a table and then select the newly created identity and return that to classic asp (JScript) without having to create a stored procedure. Can it be done?
Basically something like this:
...
rs = Server.CreateObject("ADODB.RecordSet");
rs.Open("INSERT INTO ...;SELECT SCOPE_IDENTITY() x;", objConn, ...
Response.Write(rs("x").Value);
The following works, but amounts to two trips to the database:
...
objConn.Execute("INSERT INTO ...
rs = Server.CreateObject("ADODB.RecordSet");
rs.Open("SELECT SCOPE_IDENTITY() x;", objConn, ...
Response.Write(rs("x").Value);