Replies Back to Article
Automatically set a session variable with the new record ID
i have been looking for solution all day thanks chris :0)
should have come here first DOH
Glad I could help Ian. Thanks for the post!
-Chris
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 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
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
I copied your instructions in the brief tutorial, but am getting a message:
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
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.
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.
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
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
I get just the same error, using Access 2000. The index is called "VID".
Hopefully, there are other solutions than using this extension.
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.
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
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)
logan did you manage to crack this with ASP.NET? I am trying to do the same thing