Replies Back to Article

Automatically set a session variable with the new record ID

thanks chris
August 20, 2001 by Ian Drew

i have been looking for solution all day thanks chris :0)

should have come here first DOH

RE: thanks chris
August 20, 2001 by Chris von Nieda

Glad I could help Ian.  Thanks for the post!

-Chris

Redirect to URL
September 9, 2001 by James Richie

Here is something that may be of use to users of this extention.

Insert this line before the Response.Redirect to redirect to a page with the information of the newly inserted record.

MM_editRedirectURL = MM_editRedirectURL & "?Record_ID=" & LastIdent

credit to Thomas Muck

 

I did not know where to change my code
January 22, 2002 by nicolas diogo

I could not find the right place to change the code.

The code on my page seems to be different from the one presented.

Can I ask for further assistance?

Thank you Chris

RE: I did not know where to change my code
January 23, 2002 by Chris von Nieda

Hi Nicolas.

There could be several reasons why you can't find the code.  Some of these may seem elementary but I don't know your level of experience.

1) Did you install the "Insert With Ident" extension? <if not do so>

2) Did you already create the "Insert With Ident" server behavior on the page? The code you are looking for gets written when that Server Behavior is applied.

3) If you have done both of the above then (if you are using Ultradev4) go to the menu at the top and select "Edit", then "Find and Replace" while you are in code view and search for this string: rsLastIdent.Fields.Item("Ident").Value.  When you find it you will recognize where you are and you can apply my code. 

I hope that helps!

if not let me know

-Chris 

Can't get this to work
January 24, 2002 by Lewis Smith

I copied your instructions in the brief tutorial, but am getting a message:

  • Error Type:
    Microsoft JET Database Engine (0x80040E14)
    Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.
    /sfcathedral2/bookform.asp, line 91

    My field for the record ID is "ID" do I need to replace something in the code with this?

  • Thanks for your help

  • RE: RE: I did not know where to change my code
    January 24, 2002 by nicolas diogo

    The first thing to do was to download the extension, but that was all that I did as the extension did not work.

    The error message says that the extesion was not installed, and an XML file was missing.

    I tryed to install it many times but did not work. I am using the Ultradev 4.

    Any suggestion on how to proceed ?

    Thanks Chirs.

    RE: RE: I did not know where to change my code
    January 24, 2002 by nicolas diogo

    The first thing to do was to download the extension, but that was all that I did as the extension did not work.

    The error message says that the extesion was not installed, and an XML file was missing.

    I tryed to install it many times but did not work. I am using the Ultradev 4.

    Any suggestion on how to proceed ?

    Thanks Chirs.

    RE: RE: RE: I did not know where to change my code
    February 2, 2002 by nicolas diogo

    I still can not install the extention.

    Does any one know how to fix this problem?

    Chris, Do you know how to fix it?

    Thank you

    ODBC Drivers error
    March 29, 2002 by Gert-Jan Klasens

     When I try to use this extension I also got

    this message.

    How to solve this

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.

    /test/submit.asp, line 91

    RE: ODBC Drivers error
    April 16, 2002 by Dag Henni

    I get just the same error, using Access 2000. The index is called "VID". 

    Hopefully, there are other solutions than using this extension.

    fix for DMX users
    September 21, 2002 by tom fox

    This "insert record with ident" extension does not install properly in Dreamweaver MX.  If you get the error

    ...cannot open ../editoperations.js

    when you try to add the behavior to a page then here is what you need to do.  Copy the editoperations.js file into this directory

    ..\Dreamweaver MX\Configuration\Shared\MM\Scripts\CMN

    Now open the insertrecordwithident.htm file and edit line 12 which is the line referencing editoperations.js change the file path to read

    <SCRIPT SRC="../../Shared/MM/Scripts/CMN/EditOperations.js"></SCRIPT>

    as long as you have placed editoperations.js in the directory mentioned above you should find that the extension works perfectly now.

    RE: fix for DMX users
    September 22, 2002 by Chris von Nieda

    Tom,

    Thanks for your post.  You're right. I encountered the same problem.  I'm glad to hear you found a fix.  However, for the benefit of myself and others I'm going to avoid some trial and error here and ask for a little more detail on your fix.  I just did a search on my computer for "editoperations.js" and I have 4 of them!  2 for UD4 and 2 for DMX. Which one should I copy?

    - Chris

    Pass Identity without Session Variable
    March 28, 2003 by Rip Munsterman

    I have seen numerous articles out there that claim session variables are “evil” because of they take up web server resources.  So, after playing around with the code from DMX Zone, I made a couple alterations that eliminate the session variable and allows me to simply perform a “Request(“New_ID”)” on the page I have chosen as the redirect after submitting a record.

       If (Not MM_abortEdit) Then

        ' execute the insert

                Set MM_editCmd = Server.CreateObject("ADODB.Command")

        MM_editCmd.ActiveConnection = MM_editConnection

        MM_editCmd.CommandText = "SET NOCOUNT ON;" & MM_editQuery & ";SELECT @" & "@IDENTITY AS Ident"

        Set rsLastIdent = MM_editCmd.Execute

        if NOT rsLastIdent.EOF then

        strLastIdent = rsLastIdent.Fields.Item("Ident").Value

        end if

        MM_editCmd.ActiveConnection.Close

        If (MM_editRedirectUrl <> "") Then

                MM_editRedirectUrl = MM_editRedirectUrl & "?New_ID=" & strLastIdent

          Response.Redirect(MM_editRedirectUrl)

        End If

    (strLastIdent is added to the MM_editRedirectURL variable)

    ASP.NET Version
    August 29, 2003 by Logan Couch
    Anyone know how to do this in ASP.NET using Dreamweaver MX?  I have been trying to use the @@identity but no luck.  I also need this sesion variable to work with regular ASP pages.
    ASP.NET Version
    August 29, 2003 by Logan Couch
    Anyone know how to do this in ASP.NET using Dreamweaver MX?  I have been trying to use the @@identity but no luck.  I also need this sesion variable to work with regular ASP pages.
    RE: ASP.NET version
    December 15, 2004 by Matt Bristow

    logan did you manage to crack this with ASP.NET? I am trying to do the same thing