sfakman
asked on
Dreamweaver (using an Access DB) Insert Record Type mismatch: 'LBound' error - Microsoft VBScript runtime (0x800A000D)
Hi there,
I'll try and give as much info as possible - plus all the code for the page I'm using. I'm not that experienced with ASP so please bear with me :)
Here's an out line of what I'm trying to do. It should be straight forward but I keep getting this error when using a standard DW Insert Record Server behaviour. I'm trying to post to an Access DB.
My first page consists of a form, it then passes all the fields to the Preview page. I collect all the information by using Request.Form.
In order to add all the data to the DB I've added the <% = Request.Form("FormField") %> to 10+ hidden fields underneath the Preview of what the users submission would look like. I added all the hidden fields into a form tag and then applied the Dreamweaver Insert Record Behaviour (which normally works fine).
To make sure my Hidden fields are actually holding data I also added a duplicate of each request.form (as you'll notice towards the bottom of the code) - they appear to contain the correct data passed over from the form.
Unfortuanatly, I get the following error:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'LBound'
/previewad.asp, line 82
If anyone could help I'd be so grateful as this problem is slowing me down no end. Below is the entire code for the page.
Please don't hesitate to contact me if you need any further information.
Regards,
- Georgio
---------------------- Code -----------------------
<%@LANGUAGE="VBSCRIPT"%>
<% 'On Error Resume Next %>
<!--#include file="../Connections/connS taffDeals_ admin.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariabl es("SCRIPT _NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert") ) = "PreviewAd") Then
MM_editConnection = MM_connStaffDeals_STRING
MM_editTable = "StaffDeals"
MM_editRedirectUrl = "basket.asp"
MM_fieldsStr = "AdvertType|value|CountryC ode|value| DealPrice| value|Pric eType|valu e|HolidayT ype|value| HotelName| value|Airl ine|value| OfferFirst DepDate|va lue|OfferL astDepDate |value|Des cription|v alue|Addit ionalInfo| value|Rest rictions|v alue|Offer ExpiryDate |value|Dea lTimeStamp |value|Sta tusID|valu e"
MM_columnsStr = "AdvertType|none,none,NULL |CountryCo de|',none, ''|DealPri ce|none,no ne,NULL|Pr iceType|no ne,none,NU LL|Holiday Type|none, none,NULL| HotelName| ',none,''| Airline|', none,''|Of ferFirstDe pDate|',no ne,NULL|Of ferLastDep Date|',non e,NULL|Des cription|' ,none,''|A dditionalI nfo|',none ,''|Restri ctions|',n one,''|Off erExpiryDa te|',none, NULL|DealT imeStamp|' ,none,NULL |StatusID| ',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
Response.write MM_fields
' 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_field s(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
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert") ) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1)," ,")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","'' ") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
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.ActiveConnectio n = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio n.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR edirectUrl )
End If
End If
End If
%>
<%
Dim rsCountryName__MMColParam
rsCountryName__MMColParam = "1"
If (Request.Form("CountryCode ") <> "") Then
rsCountryName__MMColParam = Request.Form("CountryCode" )
End If
%>
<%
Dim rsCountryName
Dim rsCountryName_numRows
Set rsCountryName = Server.CreateObject("ADODB .Recordset ")
rsCountryName.ActiveConnec tion = MM_connStaffDeals_STRING
rsCountryName.Source = "SELECT * FROM Countries WHERE CountryCode = '" + Replace(rsCountryName__MMC olParam, "'", "''") + "'"
rsCountryName.CursorType = 0
rsCountryName.CursorLocati on = 2
rsCountryName.LockType = 1
rsCountryName.Open()
rsCountryName_numRows = 0
%>
<%
Dim rsPricingType__MMColParam
rsPricingType__MMColParam = "1"
If (Request.Form("PriceType") <> "") Then
rsPricingType__MMColParam = Request.Form("PriceType")
End If
%>
<%
Dim rsPricingType
Dim rsPricingType_numRows
Set rsPricingType = Server.CreateObject("ADODB .Recordset ")
rsPricingType.ActiveConnec tion = MM_connStaffDeals_STRING
rsPricingType.Source = "SELECT * FROM PricingTypes WHERE PricingTypeID = " + Replace(rsPricingType__MMC olParam, "'", "''") + ""
rsPricingType.CursorType = 0
rsPricingType.CursorLocati on = 2
rsPricingType.LockType = 1
rsPricingType.Open()
rsPricingType_numRows = 0
%>
<%
Dim rsTourOperatorDetails
Dim rsTourOperatorDetails_numR ows
Set rsTourOperatorDetails = Server.CreateObject("ADODB .Recordset ")
rsTourOperatorDetails.Acti veConnecti on = MM_connStaffDeals_STRING
rsTourOperatorDetails.Sour ce = "SELECT * FROM CompanyDetails"
rsTourOperatorDetails.Curs orType = 0
rsTourOperatorDetails.Curs orLocation = 2
rsTourOperatorDetails.Lock Type = 1
rsTourOperatorDetails.Open ()
rsTourOperatorDetails_numR ows = 0
%>
<html>
<head>
<title>StaffDeals.co.uk Administration Area</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function GP_popupConfirmMsg(msg) { //v1.0
document.MM_returnValue = confirm(msg);
}
//-->
</script>
</head>
<body>
<table width="800" border="0" align="center" class="OffersBorder">
<tr>
<td height="19"> <!--#include file="includes/header_inc. asp" --> </td>
</tr>
<tr>
<td> <table width="600" border="0" align="center" cellpadding="1" cellspacing="0" class="OffersBorder">
<tr>
<td height="21" colspan="2" class="OffersHeaderText">< strong><fo nt color="#CC66CC">ENTER
DETAILS</font></strong> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">>
</font><font face="Verdana, Arial, Helvetica, sans-serif">Preview
Advert > Payment > Confirm</font></td>
</tr>
<tr>
<td height="21" colspan="2" class="SmallText">This is how your advert
will appear<br>
Advert Type =
<% = Request.Form("AdvertType") %>
</td>
</tr>
<tr>
<td width="68%" height="21" class="OffersHeaderText">< %=(rsCount ryName.Fie lds.Item(" CountryNam e").Value) %> (
<% = Request.Form("CountryCode" )%>
)</td>
<td width="32%" class="OffersHeaderText">& nbsp;</td>
</tr>
<tr>
<td valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Pricin g</strong> <br>
£</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%= Request.Form("DealPrice")% > <%= (rsPricing Type.Field s.Item("Pr icingTypeT itle").Val ue)%> </font> <div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Holida y
Type<br>
</strong>
<%
If Request.Form("HolidayType" ) = 1 then
Response.Write "Flight (Flight Only)"
Else
If Request.Form("HolidayType" ) = 2 then
Response.Write "Hotel (Accomodation Only)"
Else
If Request.Form("HolidayType" ) = 3 then
Response.Write "Package (Flights & Accomodation)"
End If
End If
End If
%>
<strong><br>
Hotel</strong><br>
<% = Request.Form("HotelName")% >
<br>
<strong>Airline<br>
</strong>
<% If Request.Form("Airline") = "" then
Response.Write "Not Available"
Else
%>
<% = Request.Form("Airline")%>
<% End If %>
<br>
<strong>Date Band</strong></font></div>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% = Request.Form("FirstDepDate _Day")%>&n bsp;<% = (MonthName(Request.Form("F irstDepDat e_Month")) )%> < % = Request.Form("FirstDepDate _Year")%>
to
<% = Request.Form("LastDepDate_ Day")%>&nb sp;<% = (MonthName(Request.Form("L astDepDate _Month"))) %> <% = Request.Form("LastDepDate_ Year")%>
<br>
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Descri ption</str ong></font ><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><br>
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% = Request.Form("Description" )%>
<br>
<strong>Additional Information</strong></font ><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><br>
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% = Request.Form("AdditionalIn fo")%>
<br>
<strong>Restrictions/Who is elegible<br>
</strong></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% = Request.Form("Restrictions ")%>
</font></td>
<td valign="top" class="SmallText"> <div align="center">
<table width="95" border="0">
<tr>
<td><table width="205" border="0" align="center" bordercolor="#CC66CC" class="OffersHeaderText">
<tr>
<td><div align="center"><%=(rsTourO peratorDet ails.Field s.Item("Co mpanyName" ).Value)%> </div></td >
</tr>
</table></td>
</tr>
<tr>
<td class="SmallText"><%=(rsTo urOperator Details.Fi elds.Item( "CompanyAd dress1").V alue)%></t d>
</tr>
<tr>
<td class="SmallText"><%=(rsTo urOperator Details.Fi elds.Item( "CompanyAd dress2").V alue)%></t d>
</tr>
<tr>
<td class="SmallText"><%=(rsTo urOperator Details.Fi elds.Item( "CompanyAd dress3").V alue)%></t d>
</tr>
<tr>
<td class="SmallText"><%=(rsTo urOperator Details.Fi elds.Item( "CompanyAd dress4").V alue)%></t d>
</tr>
<tr>
<td class="SmallText">Tel: <%=(rsTourOperatorDetails. Fields.Ite m("Company Tel").Valu e)%></td>
</tr>
<tr>
<td class="SmallText">Fax: <%=(rsTourOperatorDetails. Fields.Ite m("Company Fax").Valu e)%></td>
</tr>
<tr>
<td class="SmallText">Email: <%=(rsTourOperatorDetails. Fields.Ite m("Company Email").Va lue)%></td >
</tr>
<tr>
<td class="SmallText"><div align="left">ABTA:<%=(rsTo urOperator Details.Fi elds.Item( "CompanyAb ta").Value )%> / IATA:<%=(rsTourOperatorDet ails.Field s.Item("Co mpanyIata" ).Value)%> </div></td>
</tr>
<tr>
<td height="62" class="SmallText"> <div align="center">
<input name="Submit" type="submit" class="LinkButton" value="Contact Tour Operator" onClick="window.location=' offerinfo. asp?DealID ='">
<br>
<input name="Submit2" type="submit" class="LinkButton" value="Tour Operator Website" onClick="window.location=' offerinfo. asp?DealID ='">
<br>
<input name="Submit22" type="submit" class="LinkButton" value=" Email A Friend " onClick="window.location=' offerinfo. asp?DealID ='">
</div></td>
</tr>
</table>
</div>
<div align="center"> </div>
<div align="center"> <br>
<br>
</div></td>
</tr>
<tr>
<td valign="top" class="SmallText"> </ td>
<td valign="top" class="SmallText"> </ td>
</tr>
</table>
<br> AdvertType
<% = Request.Form("AdvertType") %>
<br> CountryCode
<% = Request.Form("CountryCode" )%>
<br> DealPrice
<% = Request.Form("DealPrice")% >
<br> PriceType
<% = Request.Form("PriceType")% >
<br> HolidayType
<% = Request.Form("HolidayType" )%>
<br> HotelName
<% = Request.Form("HotelName")% >
<br> Airline
<% = Request.Form("Airline")%>
<br> FirstDepDate
<% = Request.Form("FirstDepDate _Day")%>/< % = Request.Form("FirstDepDate _Month")%> /<% = Request.Form("FirstDepDate _Year")%>
<br> LastDepDate
<% = Request.Form("LastDepDate_ Day")%>/<% = Request.Form("LastDepDate_ Month")%>/ <% = Request.Form("LastDepDate_ Year")%>
<br> Description
<% = Request.Form("Description" )%>
<br> AdditionalInfo
<% = Request.Form("AdditionalIn fo")%>
<br> Restrictions
<% = Request.Form("Restrictions ")%>
<br> OfferExpiry_Day
<% = Request.Form("OfferExpiry_ Day")%>/<% = Request.Form("OfferExpiry_ Month")%>/ <% = Request.Form("OfferExpiry_ Year")%>
<br> Timestamp
<%=Now()%>
<br>
<% Response.write MM_tableValues %>
<div align="center"><a href="index.asp"></a> <strong><br>
</strong>
<form ACTION="<%=MM_editAction%> " method="POST" enctype="multipart/form-da ta" name="PreviewAd" id="PreviewAd">
<strong>
<input name="submit" type="button" onClick="javascript:histor y.back()" class="LinkButton" value="Go Back and Amend">
<input name="submit2" type="submit" class="LinkButton" onClick="GP_popupConfirmMs g('Are you sure you want to confirm this advert?');return document.MM_returnValue" value="Confirm">
<input name="AdvertType" type="hidden" id="AdvertType" value="<% = Request.Form("AdvertType") %>">
<input name="CountryCode" type="hidden" id="CountryCode" value="<% = Request.Form("CountryCode" )%>">
<input name="DealPrice" type="hidden" id="DealPrice" value="<% = Request.Form("DealPrice")% >">
<input name="PriceType" type="hidden" id="PriceType" value="<% = Request.Form("PriceType")% >">
<input name="HolidayType" type="hidden" id="HolidayType" value="<% = Request.Form("HolidayType" )%>">
<input name="HotelName" type="hidden" id="HotelName" value="<% = Request.Form("HotelName")% >">
<input name="Airline" type="hidden" id="Airline" value="<% = Request.Form("Airline")%>" >
<input name="OfferFirstDepDate" type="hidden" id="OfferFirstDepDate" value="<% = Request.Form("FirstDepDate _Day")%>/< % = Request.Form("FirstDepDate _Month")%> /<% = Request.Form("FirstDepDate _Year")%>" >
<input name="OfferLastDepDate" type="hidden" id="OfferLastDepDate" value="<% = Request.Form("LastDepDate_ Day")%>/<% = Request.Form("LastDepDate_ Month")%>/ <% = Request.Form("LastDepDate_ Year")%>">
<input name="Description" type="hidden" id="Description" value="<% = Request.Form("Description" )%>">
<input name="AdditionalInfo" type="hidden" id="AdditionalInfo" value="<% = Request.Form("AdditionalIn fo")%>">
<input name="Restrictions" type="hidden" id="Restrictions" value="<% = Request.Form("Restrictions ")%>">
<input name="OfferExpiryDate" type="hidden" id="OfferExpiryDate" value="<% = Request.Form("OfferExpiry_ Day")%>/<% = Request.Form("OfferExpiry_ Month")%>/ <% = Request.Form("OfferExpiry_ Year")%>">
<input name="DealTimeStamp" type="hidden" id="DealTimeStamp" value="<%=Now()%>">
<input name="StatusID" type="hidden" id="StatusID" value="PM">
</strong>
<input type="hidden" name="MM_insert" value="PreviewAd">
</form>
<strong> </strong> </div>
<p> </p></td>
</tr>
<tr>
<td> <!--#include file="../includes/footer_i nc.asp" --> </td>
</tr>
</table>
</body>
</html>
<%
rsCountryName.Close()
Set rsCountryName = Nothing
%>
<%
rsPricingType.Close()
Set rsPricingType = Nothing
%>
<%
rsTourOperatorDetails.Clos e()
Set rsTourOperatorDetails = Nothing
%>
I'll try and give as much info as possible - plus all the code for the page I'm using. I'm not that experienced with ASP so please bear with me :)
Here's an out line of what I'm trying to do. It should be straight forward but I keep getting this error when using a standard DW Insert Record Server behaviour. I'm trying to post to an Access DB.
My first page consists of a form, it then passes all the fields to the Preview page. I collect all the information by using Request.Form.
In order to add all the data to the DB I've added the <% = Request.Form("FormField") %> to 10+ hidden fields underneath the Preview of what the users submission would look like. I added all the hidden fields into a form tag and then applied the Dreamweaver Insert Record Behaviour (which normally works fine).
To make sure my Hidden fields are actually holding data I also added a duplicate of each request.form (as you'll notice towards the bottom of the code) - they appear to contain the correct data passed over from the form.
Unfortuanatly, I get the following error:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'LBound'
/previewad.asp, line 82
If anyone could help I'd be so grateful as this problem is slowing me down no end. Below is the entire code for the page.
Please don't hesitate to contact me if you need any further information.
Regards,
- Georgio
---------------------- Code -----------------------
<%@LANGUAGE="VBSCRIPT"%>
<% 'On Error Resume Next %>
<!--#include file="../Connections/connS
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariabl
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")
MM_editConnection = MM_connStaffDeals_STRING
MM_editTable = "StaffDeals"
MM_editRedirectUrl = "basket.asp"
MM_fieldsStr = "AdvertType|value|CountryC
MM_columnsStr = "AdvertType|none,none,NULL
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
Response.write MM_fields
' 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_field
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
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),"
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
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
MM_editCmd.ActiveConnectio
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR
End If
End If
End If
%>
<%
Dim rsCountryName__MMColParam
rsCountryName__MMColParam = "1"
If (Request.Form("CountryCode
rsCountryName__MMColParam = Request.Form("CountryCode"
End If
%>
<%
Dim rsCountryName
Dim rsCountryName_numRows
Set rsCountryName = Server.CreateObject("ADODB
rsCountryName.ActiveConnec
rsCountryName.Source = "SELECT * FROM Countries WHERE CountryCode = '" + Replace(rsCountryName__MMC
rsCountryName.CursorType = 0
rsCountryName.CursorLocati
rsCountryName.LockType = 1
rsCountryName.Open()
rsCountryName_numRows = 0
%>
<%
Dim rsPricingType__MMColParam
rsPricingType__MMColParam = "1"
If (Request.Form("PriceType")
rsPricingType__MMColParam = Request.Form("PriceType")
End If
%>
<%
Dim rsPricingType
Dim rsPricingType_numRows
Set rsPricingType = Server.CreateObject("ADODB
rsPricingType.ActiveConnec
rsPricingType.Source = "SELECT * FROM PricingTypes WHERE PricingTypeID = " + Replace(rsPricingType__MMC
rsPricingType.CursorType = 0
rsPricingType.CursorLocati
rsPricingType.LockType = 1
rsPricingType.Open()
rsPricingType_numRows = 0
%>
<%
Dim rsTourOperatorDetails
Dim rsTourOperatorDetails_numR
Set rsTourOperatorDetails = Server.CreateObject("ADODB
rsTourOperatorDetails.Acti
rsTourOperatorDetails.Sour
rsTourOperatorDetails.Curs
rsTourOperatorDetails.Curs
rsTourOperatorDetails.Lock
rsTourOperatorDetails.Open
rsTourOperatorDetails_numR
%>
<html>
<head>
<title>StaffDeals.co.uk Administration Area</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function GP_popupConfirmMsg(msg) { //v1.0
document.MM_returnValue = confirm(msg);
}
//-->
</script>
</head>
<body>
<table width="800" border="0" align="center" class="OffersBorder">
<tr>
<td height="19"> <!--#include file="includes/header_inc.
</tr>
<tr>
<td> <table width="600" border="0" align="center" cellpadding="1" cellspacing="0" class="OffersBorder">
<tr>
<td height="21" colspan="2" class="OffersHeaderText"><
DETAILS</font></strong> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">>
</font><font face="Verdana, Arial, Helvetica, sans-serif">Preview
Advert > Payment > Confirm</font></td>
</tr>
<tr>
<td height="21" colspan="2" class="SmallText">This is how your advert
will appear<br>
Advert Type =
<% = Request.Form("AdvertType")
</td>
</tr>
<tr>
<td width="68%" height="21" class="OffersHeaderText"><
<% = Request.Form("CountryCode"
)</td>
<td width="32%" class="OffersHeaderText">&
</tr>
<tr>
<td valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Pricin
£</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%= Request.Form("DealPrice")%
Type<br>
</strong>
<%
If Request.Form("HolidayType"
Response.Write "Flight (Flight Only)"
Else
If Request.Form("HolidayType"
Response.Write "Hotel (Accomodation Only)"
Else
If Request.Form("HolidayType"
Response.Write "Package (Flights & Accomodation)"
End If
End If
End If
%>
<strong><br>
Hotel</strong><br>
<% = Request.Form("HotelName")%
<br>
<strong>Airline<br>
</strong>
<% If Request.Form("Airline") = "" then
Response.Write "Not Available"
Else
%>
<% = Request.Form("Airline")%>
<% End If %>
<br>
<strong>Date Band</strong></font></div>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% = Request.Form("FirstDepDate
to
<% = Request.Form("LastDepDate_
<br>
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Descri
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% = Request.Form("Description"
<br>
<strong>Additional Information</strong></font
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% = Request.Form("AdditionalIn
<br>
<strong>Restrictions/Who is elegible<br>
</strong></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% = Request.Form("Restrictions
</font></td>
<td valign="top" class="SmallText"> <div align="center">
<table width="95" border="0">
<tr>
<td><table width="205" border="0" align="center" bordercolor="#CC66CC" class="OffersHeaderText">
<tr>
<td><div align="center"><%=(rsTourO
</tr>
</table></td>
</tr>
<tr>
<td class="SmallText"><%=(rsTo
</tr>
<tr>
<td class="SmallText"><%=(rsTo
</tr>
<tr>
<td class="SmallText"><%=(rsTo
</tr>
<tr>
<td class="SmallText"><%=(rsTo
</tr>
<tr>
<td class="SmallText">Tel: <%=(rsTourOperatorDetails.
</tr>
<tr>
<td class="SmallText">Fax: <%=(rsTourOperatorDetails.
</tr>
<tr>
<td class="SmallText">Email: <%=(rsTourOperatorDetails.
</tr>
<tr>
<td class="SmallText"><div align="left">ABTA:<%=(rsTo
</tr>
<tr>
<td height="62" class="SmallText"> <div align="center">
<input name="Submit" type="submit" class="LinkButton" value="Contact Tour Operator" onClick="window.location='
<br>
<input name="Submit2" type="submit" class="LinkButton" value="Tour Operator Website" onClick="window.location='
<br>
<input name="Submit22" type="submit" class="LinkButton" value=" Email A Friend " onClick="window.location='
</div></td>
</tr>
</table>
</div>
<div align="center"> </div>
<div align="center"> <br>
<br>
</div></td>
</tr>
<tr>
<td valign="top" class="SmallText"> </
<td valign="top" class="SmallText"> </
</tr>
</table>
<br> AdvertType
<% = Request.Form("AdvertType")
<br> CountryCode
<% = Request.Form("CountryCode"
<br> DealPrice
<% = Request.Form("DealPrice")%
<br> PriceType
<% = Request.Form("PriceType")%
<br> HolidayType
<% = Request.Form("HolidayType"
<br> HotelName
<% = Request.Form("HotelName")%
<br> Airline
<% = Request.Form("Airline")%>
<br> FirstDepDate
<% = Request.Form("FirstDepDate
<br> LastDepDate
<% = Request.Form("LastDepDate_
<br> Description
<% = Request.Form("Description"
<br> AdditionalInfo
<% = Request.Form("AdditionalIn
<br> Restrictions
<% = Request.Form("Restrictions
<br> OfferExpiry_Day
<% = Request.Form("OfferExpiry_
<br> Timestamp
<%=Now()%>
<br>
<% Response.write MM_tableValues %>
<div align="center"><a href="index.asp"></a> <strong><br>
</strong>
<form ACTION="<%=MM_editAction%>
<strong>
<input name="submit" type="button" onClick="javascript:histor
<input name="submit2" type="submit" class="LinkButton" onClick="GP_popupConfirmMs
<input name="AdvertType" type="hidden" id="AdvertType" value="<% = Request.Form("AdvertType")
<input name="CountryCode" type="hidden" id="CountryCode" value="<% = Request.Form("CountryCode"
<input name="DealPrice" type="hidden" id="DealPrice" value="<% = Request.Form("DealPrice")%
<input name="PriceType" type="hidden" id="PriceType" value="<% = Request.Form("PriceType")%
<input name="HolidayType" type="hidden" id="HolidayType" value="<% = Request.Form("HolidayType"
<input name="HotelName" type="hidden" id="HotelName" value="<% = Request.Form("HotelName")%
<input name="Airline" type="hidden" id="Airline" value="<% = Request.Form("Airline")%>"
<input name="OfferFirstDepDate" type="hidden" id="OfferFirstDepDate" value="<% = Request.Form("FirstDepDate
<input name="OfferLastDepDate" type="hidden" id="OfferLastDepDate" value="<% = Request.Form("LastDepDate_
<input name="Description" type="hidden" id="Description" value="<% = Request.Form("Description"
<input name="AdditionalInfo" type="hidden" id="AdditionalInfo" value="<% = Request.Form("AdditionalIn
<input name="Restrictions" type="hidden" id="Restrictions" value="<% = Request.Form("Restrictions
<input name="OfferExpiryDate" type="hidden" id="OfferExpiryDate" value="<% = Request.Form("OfferExpiry_
<input name="DealTimeStamp" type="hidden" id="DealTimeStamp" value="<%=Now()%>">
<input name="StatusID" type="hidden" id="StatusID" value="PM">
</strong>
<input type="hidden" name="MM_insert" value="PreviewAd">
</form>
<strong> </strong> </div>
<p> </p></td>
</tr>
<tr>
<td> <!--#include file="../includes/footer_i
</tr>
</table>
</body>
</html>
<%
rsCountryName.Close()
Set rsCountryName = Nothing
%>
<%
rsPricingType.Close()
Set rsPricingType = Nothing
%>
<%
rsTourOperatorDetails.Clos
Set rsTourOperatorDetails = Nothing
%>
ASKER
Hi
Thanks for that - I'm a bit confused... I've read your answer and I kind of understand it but I'm not 100% confident - what changes do I have to make to the code in order for the form to successfully add the data to the DB?
Thanks,
Georgio
Thanks for that - I'm a bit confused... I've read your answer and I kind of understand it but I'm not 100% confident - what changes do I have to make to the code in order for the form to successfully add the data to the DB?
Thanks,
Georgio
Oh boy, that's going to take a while....
I am finishing a few things up now, but I will try to get to this in a little while.
Fritz the Blank
I am finishing a few things up now, but I will try to get to this in a little while.
Fritz the Blank
ASKER
Thanks for your time Fritz - it's ok - no hurry as I'm off to bed now. So is this a bug in Dreamweaver? I'm not sure why this would happen as it's no different to any other form DW produces apart from it's entirely made from Hidden fields.
I'll catch up with you soon.
All the best
Georgio
I'll catch up with you soon.
All the best
Georgio
It is not so much a bug in Dreamweaver as it is that you are using the code in a way they didn't allow for.
FtB
FtB
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To me on this one?
FtB
FtB
If (CStr(Request("MM_insert")
but line 82 occurs after this:
If (CStr(Request("MM_insert")
which means that MM_Fields is never defined, and that is why you are getting an error.
Relevant section follows:
If (CStr(Request("MM_insert")
MM_editConnection = MM_connStaffDeals_STRING
MM_editTable = "StaffDeals"
MM_editRedirectUrl = "basket.asp"
MM_fieldsStr = "AdvertType|value|CountryC
MM_columnsStr = "AdvertType|none,none,NULL
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
Response.write MM_fields
' 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_field
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
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert")
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),"
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
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
MM_editCmd.ActiveConnectio
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnectio
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editR
End If
End If
End If