×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

DreamWeaver 101

How to create a "Session ID" from a newly inserted record... by TonyU
Posted: 28 Jan 03



Here's a way to create a Session ID from a newly inserted record from a database.

**********************************************
'Immediatelly after your insert statement be sure to comment out the following statements:
  • ' MM_editCmd.ActiveConnection.Close
  • 'Response.Redirect(MM_editRedirectUrl)

as shown below and adding the script in blue


  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  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
    MM_editCmd.Execute
' MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
'Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
If (CStr(Request("MM_insert")) <> "") Then
set TonyRS = Server.CreateObject("ADODB.Recordset")
TonyRS.ActiveConnection = MM_editCmd.ActiveConnection
TonyRS.Source = "SELECT max(id) as MaxID FROM YOUR_TABLE"
TonyRS.CursorType = 0
TonyRS.CursorLocation = 2
TonyRS.LockType = 3
TonyRS.Open()
Session("NewID")=TonyRS("MaxID")
Response.Redirect(MM_editRedirectUrl)
end if
%>

**********************************************

As you can see, I'm selecting the MAX (id) from the database and creating a session("NewID") that you can call from anywhere you need to.

I hope this faq helps you.

Thanks

Back to Adobe FAQ Index
Back to Adobe Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close