Forums
This topic is locked
Different Dreamweaver versions, different ASP Inse
Posted 09 May 2007 01:43:00
1
has voted
09 May 2007 01:43:00 Aaron Ekinaka posted:
Hi. In our office we have several different versions of Dreamweaver (Dreamweaver 8 and now Dreamweaver CS3). When developing ASP pages our old version would produce code for handling INSERT RECORD commands which work fine. The code looks very similar to the following:<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert") = "seminarregistration" Then
MM_editConnection = MM_seminardatabase_STRING
MM_editTable = "seminarregistration"
MM_editRedirectUrl = "registration_successful.htm"
MM_fieldsStr = "firstname|value|lastname|value|address|value|city|value|state|value|zipcode|value|phone|value|fax|value|email|value|oetracker|value|license|value|ceaccount|value|eventname|value|eventdate|value|paymentamount|value|paymentmethod|value|ccnumber1|value|ccnumber2|value|ccnumber3|value|ccnumber4|value|cctype|value|ccexpiration|value|cvccode|value|ccbillingzipcode|value|meal|value|wdsinvoice|value|registrationdate|value|checkinstatus|value|confirmationsent|value"
MM_columnsStr = "firstname|',none,''|lastname|',none,''|address|',none,''|city|',none,''|state|',none,''|zipcode|',none,''|phone|',none,''|fax|',none,''|email|',none,''|oetracker|',none,''|license|',none,''|ceaccount|',none,''|eventname|',none,''|eventdate|',none,''|paymentamount|',none,''|paymentmethod|',none,''|ccnumber1|',none,''|ccnumber2|',none,''|ccnumber3|',none,''|ccnumber4|',none,''|cctype|',none,''|ccexpiration|',none,''|cvccode|',none,''|ccbillingzipcode|',none,''|meal|',none,''|wdsinvoice|',none,''|registrationdate|',none,''|checkinstatus|',none,''|confirmationsent|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
However, now with CS3 it is making code that looks very different from the code ive listed above. This is what the new code looks like:
<%
If (CStr(Request("MM_insert") = "seminarregistration" Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command"
MM_editCmd.ActiveConnection = MM_seminardatabase_STRING
MM_editCmd.CommandText = "INSERT INTO seminarregistration (firstname, lastname, address, city, [state], zipcode, phone, fax, email, oetracker, license, ceaccount, eventname, eventdate, paymentamount, paymentmethod, ccnumber1, ccnumber2, ccnumber3, ccnumber4, cctype, ccexpiration, cvccode, ccbillingzipcode, meal, wdsinvoice, registrationdate, checkinstatus, confirmationsent) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("firstname") ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("lastname") ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("address") ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 50, Request.Form("city") ' adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "registration_successful.htm"
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
%>
The problem comes about when we are trying to use this new code (dreamweaver is now putting this in by default when we are creating pages that alter a MySQL database by INSERTING / UPDATING / or DELETING records via ASP. Web browsers report that everything breaks at the " MM_editCmd.Execute" section. Why is this? Why is dreamweaver using this new formatting? Is there a way we can make it use the old way?
Thanks for your help.
-Aaron
Replies
Replied 16 May 2007 22:37:26
16 May 2007 22:37:26 dave blohm replied:
I asked roughly this same question a few days back...
Here's the explanation I was given:
www.dmxzone.com/forum/topic.asp?topic_id=38454
- Doc
Progress is made by the discontent.
Here's the explanation I was given:
www.dmxzone.com/forum/topic.asp?topic_id=38454
- Doc
Progress is made by the discontent.
Replied 16 May 2007 23:00:39
16 May 2007 23:00:39 Aaron Ekinaka replied:
Thanks for the tip Dave. I understand now that is a security related upgrade. We need to now figure out why our pages don't like to use this formatting...
Replied 08 May 2008 17:57:44
08 May 2008 17:57:44 Jake M replied:
How do I solve this problem? It will not let me insert in to my table unless all fields are completed?
Replied 08 May 2008 18:14:41
08 May 2008 18:14:41 dave blohm replied:
I solved it by getting everyone on the same version of DW and updating all the openrecord segments on all my pages...
- Doc
Progress is made by the discontent.
- Doc
Progress is made by the discontent.