A
Axi
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 (Using Dreamweaver), but
didnt work for the SP.
This is part of the code I have for the insert for the ASP (Dreamweaver).
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 -->
This is part of the code that I am using with the Insert Stored Procedure:
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
Thanks in advance,
Axi
ASP VB / MS SQL 2000
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 (Using Dreamweaver), but
didnt work for the SP.
This is part of the code I have for the insert for the ASP (Dreamweaver).
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 -->
This is part of the code that I am using with the Insert Stored Procedure:
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
Thanks in advance,
Axi
ASP VB / MS SQL 2000