Copy link to clipboard
Copied
DW CS3 - ASP
Am going through an old (but excellent) training DVD for creating Insert/Update/Delete Record forms using DW & ASP.
Two forms are created on the same page - one to Update Record and one to Delete Record. Update works, but Delete creates an error:
Microsoft VBScript compilation error '800a0411'
Name redefined
/mysitename/myfolder/admin_edit.asp, line 95
Dim MM_editRedirectUrl
This error is apparently due to different redirect URLs for each form:
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "admin_edit.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "admin_home.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
I read that renaming the second Dim MM_editRedirectUrl to Dim MM_editRedirectUrl_2 will make things work correctly, and it DID! However, does this make for an unstable environment; and if so, what's the best approach to fixing this?
Ok, that makes sense. The original problem and solution stands. When the edit/detail page loads it sees the scripts and variables from both behaviors, and that the same variable name is used in both instances. So changing the variable names in one or the other behaviors will work and won't cause any instability.
Copy link to clipboard
Copied
>Name redefined
means you defined the variable, and then try to define it again. That's an error in any language. Just remove the second definition entirely and it should be ok, right?
Copy link to clipboard
Copied
The problem is that DW is using the same variable name for two different operations, even though you can only use one. There's no problem with renaming the variable in the second instance, it's just a variable name that contains the redirect URL for that operation. Just make sure you rename it wherever it appears in that block of code. I've never heard if that making anything unstable - what makes you believe that? it is possible I guess, and if it's true I'd like to know more about it as I've often renamed these variables that DW creates.
Copy link to clipboard
Copied
Thanks to both answers. Was just going by DVD instructions which caused the problem in the first place.
Copy link to clipboard
Copied
I just noticed the the redirect URL for the delete behavior goes back to the same page that contains the forms? Do you get the error when the page loads or when attempting to delete a record?
Copy link to clipboard
Copied
The edit page has two forms – update and delete. The redirect URL for the update behavior stays on the edit page. The redirect URL for the delete behavior goes to the home page.
The home page includes one insert form and a recordset. The error happens from the home page when trying to load the edit page via the recordset and ‘go to detail page’ behavior.
Again, just going by old instruction with newer version of DW.
Copy link to clipboard
Copied
Ok, that makes sense. The original problem and solution stands. When the edit/detail page loads it sees the scripts and variables from both behaviors, and that the same variable name is used in both instances. So changing the variable names in one or the other behaviors will work and won't cause any instability.
Copy link to clipboard
Copied
Wonderful! Thank you!! Guess I'll add a VBScript book to my library...
Copy link to clipboard
Copied
Have you ventured into PHP at all? I used ASP exclusively at first and just when I was starting to get fluent in VBScript, MS dropped support for what is now known as "classic" ASP and took off into ASP.NET. And that was about the same time the DW dropped support for ASP.NET. I decided to stick with DW and learn PHP - I still don't know it as well as VBScript, but I can still do quite a bit with it using both the built in behaviors and some 3rd party extensions. Plus, I don't think that PHP is as fussy as classic ASP - I'm not entirely sure, but if your application was in PHP, that detail page may not have minded the duplicate variable name, or would have known it already existed before writing the code for the second behavior. Don't quote me on that.
Database set up and management was more of a challenge using phpMyAdmin with the MySQL database. A little more rudimentary than using a MS Access project file (ADP file extension) to connect to a MSSQL database and administrate. But there are other MySQL tools out there that may provide more of the visual interface like Access.
Copy link to clipboard
Copied
I did look into PHP/ MySQL, then decided ASP/ Access is currently sufficient for my small-scale operation. I also looked into ASP.NET a bit, but since DW (or Adobe) dropped its support, I figured why bother. In fact, due to continual drop in support in versions above CS3, I won’t be upgrading.
Not sure, but I think if I were using anything other than ASP, both behaviors (update/delete) could’ve been combined in one form. I’m a one-man-band in this project and learn as I go. Thanks so much for you help and ideas!
Copy link to clipboard
Copied
You're welcome. Same here - learn as I go and usually a one man band also.