Question
Generating Record ID Upon Submission
I hope im explaining this correctly.
In the past, when using MX 2004 in a form that would create a new record in SQL, there was a simple function to immediately query the db for this new ID to attach to a custom email message upon successful record submission
Here's the code that would get added
-----[SET NOCOUNT ON] in the beginning and [SELECT @@IDENTITY AS NewID SET NOCOUNT OFF] at the end
MM_editQuery = "SET NOCOUNT ON insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ") SELECT @@IDENTITY AS NewID SET NOCOUNT OFF"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
Set rsNewID=MM_editCmd.Execute
intNewID=rsNewID("NewID")
MM_editCmd.ActiveConnection.Close
-- you can then use intNewID to pull what the new record id will be upon submission.
My problem is this does not work in CS3. the record doesnt even get submitted so whatever this code is doing, it's completely stopping the submission process.
Is there anything other than what im trying that can fix this?
If I didnt supply enough info, please let me know.
Thanks!
In the past, when using MX 2004 in a form that would create a new record in SQL, there was a simple function to immediately query the db for this new ID to attach to a custom email message upon successful record submission
Here's the code that would get added
-----[SET NOCOUNT ON] in the beginning and [SELECT @@IDENTITY AS NewID SET NOCOUNT OFF] at the end
MM_editQuery = "SET NOCOUNT ON insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ") SELECT @@IDENTITY AS NewID SET NOCOUNT OFF"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
Set rsNewID=MM_editCmd.Execute
intNewID=rsNewID("NewID")
MM_editCmd.ActiveConnection.Close
-- you can then use intNewID to pull what the new record id will be upon submission.
My problem is this does not work in CS3. the record doesnt even get submitted so whatever this code is doing, it's completely stopping the submission process.
Is there anything other than what im trying that can fix this?
If I didnt supply enough info, please let me know.
Thanks!
