Hi,

I made an insert using a Stored Procedure (MS SQL 2000), how can I store the
ID of the last inserted record into a session var ? I have code to do this
with a regular "Insert" page, but didnt work for the SP.

This is the code I have for the insert:

code ....
MM_editCmd.Execute();

<!--set up Auto Number retrieval for SQL Server -->
var rsNewAutoIncrement = MM_editCmd.ActiveConnection.Execute("select
@@identity")
Session("svReq_ID") = rsNewAutoIncrement(0).Value
<!--rsNewAutoIncrement.Close -->
<!--var rsNewAutoIncrement = Nothing -->
<!--end retrieval -->


If I have the SP the last lines of code would be:


AddInvoice.Parameters.Append AddInvoice.CreateParameter("@State", 200,
1,25,AddInvoice__State)
AddInvoice.Parameters.Append AddInvoice.CreateParameter("@Zip", 200,
1,25,AddInvoice__Zip)
AddInvoice.CommandType = 4
AddInvoice.CommandTimeout = 0
AddInvoice.Prepared = true
AddInvoice.Execute()

%>

I need to add code here to retreive the ID just insterted, but the above
code didnt work ... I am looking in the web in the meantime, but if someone knows where I could find it that would save a lot of time ...

Thanks in advance,

Axi