?
Solved

Dreamweaver (using an Access DB) Insert Record Type mismatch: 'LBound' error - Microsoft VBScript runtime (0x800A000D)

Posted on 2004-04-28
10
Medium Priority
?
520 Views
Last Modified: 2007-12-19
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/connStaffDeals_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.ServerVariables("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|CountryCode|value|DealPrice|value|PriceType|value|HolidayType|value|HotelName|value|Airline|value|OfferFirstDepDate|value|OfferLastDepDate|value|Description|value|AdditionalInfo|value|Restrictions|value|OfferExpiryDate|value|DealTimeStamp|value|StatusID|value"
  MM_columnsStr = "AdvertType|none,none,NULL|CountryCode|',none,''|DealPrice|none,none,NULL|PriceType|none,none,NULL|HolidayType|none,none,NULL|HotelName|',none,''|Airline|',none,''|OfferFirstDepDate|',none,NULL|OfferLastDepDate|',none,NULL|Description|',none,''|AdditionalInfo|',none,''|Restrictions|',none,''|OfferExpiryDate|',none,NULL|DealTimeStamp|',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_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
%>
<%
' *** 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.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    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.ActiveConnection = MM_connStaffDeals_STRING
rsCountryName.Source = "SELECT * FROM Countries WHERE CountryCode = '" + Replace(rsCountryName__MMColParam, "'", "''") + "'"
rsCountryName.CursorType = 0
rsCountryName.CursorLocation = 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.ActiveConnection = MM_connStaffDeals_STRING
rsPricingType.Source = "SELECT * FROM PricingTypes WHERE PricingTypeID = " + Replace(rsPricingType__MMColParam, "'", "''") + ""
rsPricingType.CursorType = 0
rsPricingType.CursorLocation = 2
rsPricingType.LockType = 1
rsPricingType.Open()

rsPricingType_numRows = 0
%>
<%
Dim rsTourOperatorDetails
Dim rsTourOperatorDetails_numRows

Set rsTourOperatorDetails = Server.CreateObject("ADODB.Recordset")
rsTourOperatorDetails.ActiveConnection = MM_connStaffDeals_STRING
rsTourOperatorDetails.Source = "SELECT * FROM CompanyDetails"
rsTourOperatorDetails.CursorType = 0
rsTourOperatorDetails.CursorLocation = 2
rsTourOperatorDetails.LockType = 1
rsTourOperatorDetails.Open()

rsTourOperatorDetails_numRows = 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><font color="#CC66CC">ENTER
            DETAILS</font></strong> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">&gt;
            </font><font face="Verdana, Arial, Helvetica, sans-serif">Preview
            Advert &gt; Payment &gt; 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"><%=(rsCountryName.Fields.Item("CountryName").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>Pricing</strong><br>
            &pound;</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%= Request.Form("DealPrice")%>&nbsp;<%=(rsPricingType.Fields.Item("PricingTypeTitle").Value)%> </font> <div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Holiday
              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")%>&nbsp;<% = (MonthName(Request.Form("FirstDepDate_Month")))%>&nbsp;<% = Request.Form("FirstDepDate_Year")%>
            to
            <% = Request.Form("LastDepDate_Day")%>&nbsp;<% = (MonthName(Request.Form("LastDepDate_Month")))%>&nbsp;<% = Request.Form("LastDepDate_Year")%>
            <br>
            </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Description</strong></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("AdditionalInfo")%>
            <br>
            <strong>Restrictions/Who is elegible<br>
            </strong></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
            <% = Request.Form("Restrictions")%>
            &nbsp;</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"><%=(rsTourOperatorDetails.Fields.Item("CompanyName").Value)%></div></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td class="SmallText"><%=(rsTourOperatorDetails.Fields.Item("CompanyAddress1").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText"><%=(rsTourOperatorDetails.Fields.Item("CompanyAddress2").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText"><%=(rsTourOperatorDetails.Fields.Item("CompanyAddress3").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText"><%=(rsTourOperatorDetails.Fields.Item("CompanyAddress4").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText">Tel: <%=(rsTourOperatorDetails.Fields.Item("CompanyTel").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText">Fax: <%=(rsTourOperatorDetails.Fields.Item("CompanyFax").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText">Email: <%=(rsTourOperatorDetails.Fields.Item("CompanyEmail").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText"><div align="left">ABTA:<%=(rsTourOperatorDetails.Fields.Item("CompanyAbta").Value)%> / IATA:<%=(rsTourOperatorDetails.Fields.Item("CompanyIata").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">&nbsp;</td>
          <td valign="top" class="SmallText">&nbsp;</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("AdditionalInfo")%>
        <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-data" name="PreviewAd" id="PreviewAd">
          <strong>
          <input name="submit" type="button" onClick="javascript:history.back()" class="LinkButton" value="Go Back and Amend">
          <input name="submit2" type="submit" class="LinkButton" onClick="GP_popupConfirmMsg('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("AdditionalInfo")%>">
          <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>&nbsp;</p></td>
  </tr>
  <tr>
    <td> <!--#include file="../includes/footer_inc.asp" --> </td>
  </tr>
</table>
</body>
</html>
<%
rsCountryName.Close()
Set rsCountryName = Nothing
%>
<%
rsPricingType.Close()
Set rsPricingType = Nothing
%>
<%
rsTourOperatorDetails.Close()
Set rsTourOperatorDetails = Nothing
%>
0
Comment
Question by:sfakman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
10 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10944406
Here is the problem--you define MM_Fields under the condition of this:

If (CStr(Request("MM_insert")) = "PreviewAd") Then


but line 82 occurs after this:

If (CStr(Request("MM_insert")) <> "") Then

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")) = "PreviewAd") Then

  MM_editConnection = MM_connStaffDeals_STRING
  MM_editTable = "StaffDeals"
  MM_editRedirectUrl = "basket.asp"
  MM_fieldsStr  = "AdvertType|value|CountryCode|value|DealPrice|value|PriceType|value|HolidayType|value|HotelName|value|Airline|value|OfferFirstDepDate|value|OfferLastDepDate|value|Description|value|AdditionalInfo|value|Restrictions|value|OfferExpiryDate|value|DealTimeStamp|value|StatusID|value"
  MM_columnsStr = "AdvertType|none,none,NULL|CountryCode|',none,''|DealPrice|none,none,NULL|PriceType|none,none,NULL|HolidayType|none,none,NULL|HotelName|',none,''|Airline|',none,''|OfferFirstDepDate|',none,NULL|OfferLastDepDate|',none,NULL|Description|',none,''|AdditionalInfo|',none,''|Restrictions|',none,''|OfferExpiryDate|',none,NULL|DealTimeStamp|',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_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
%>
<%
' *** 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.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
0
 

Author Comment

by:sfakman
ID: 10944501
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
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10944507
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sfakman
ID: 10944558
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
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 10944574
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
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 1000 total points
ID: 10944822
I don't know if this will fix it or not ( I can't test it) but you can give this a shot...

<%@LANGUAGE="VBSCRIPT"%>
<% 'On Error Resume Next %>
<!--#include file="../Connections/connStaffDeals_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.ServerVariables("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
  MM_fieldsStr  = "AdvertType|value|CountryCode|value|DealPrice|value|PriceType|value|HolidayType|value|HotelName|value|Airline|value|OfferFirstDepDate|value|OfferLastDepDate|value|Description|value|AdditionalInfo|value|Restrictions|value|OfferExpiryDate|value|DealTimeStamp|value|StatusID|value"
  MM_columnsStr = "AdvertType|none,none,NULL|CountryCode|',none,''|DealPrice|none,none,NULL|PriceType|none,none,NULL|HolidayType|none,none,NULL|HotelName|',none,''|Airline|',none,''|OfferFirstDepDate|',none,NULL|OfferLastDepDate|',none,NULL|Description|',none,''|AdditionalInfo|',none,''|Restrictions|',none,''|OfferExpiryDate|',none,NULL|DealTimeStamp|',none,NULL|StatusID|',none,''"

If (CStr(Request("MM_insert")) = "PreviewAd") Then

  MM_editConnection = MM_connStaffDeals_STRING
  MM_editTable = "StaffDeals"
  MM_editRedirectUrl = "basket.asp"

  ' 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_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
%>
<%
' *** 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.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    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.ActiveConnection = MM_connStaffDeals_STRING
rsCountryName.Source = "SELECT * FROM Countries WHERE CountryCode = '" + Replace(rsCountryName__MMColParam, "'", "''") + "'"
rsCountryName.CursorType = 0
rsCountryName.CursorLocation = 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.ActiveConnection = MM_connStaffDeals_STRING
rsPricingType.Source = "SELECT * FROM PricingTypes WHERE PricingTypeID = " + Replace(rsPricingType__MMColParam, "'", "''") + ""
rsPricingType.CursorType = 0
rsPricingType.CursorLocation = 2
rsPricingType.LockType = 1
rsPricingType.Open()

rsPricingType_numRows = 0
%>
<%
Dim rsTourOperatorDetails
Dim rsTourOperatorDetails_numRows

Set rsTourOperatorDetails = Server.CreateObject("ADODB.Recordset")
rsTourOperatorDetails.ActiveConnection = MM_connStaffDeals_STRING
rsTourOperatorDetails.Source = "SELECT * FROM CompanyDetails"
rsTourOperatorDetails.CursorType = 0
rsTourOperatorDetails.CursorLocation = 2
rsTourOperatorDetails.LockType = 1
rsTourOperatorDetails.Open()

rsTourOperatorDetails_numRows = 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><font color="#CC66CC">ENTER
            DETAILS</font></strong> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">&gt;
            </font><font face="Verdana, Arial, Helvetica, sans-serif">Preview
            Advert &gt; Payment &gt; 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"><%=(rsCountryName.Fields.Item("CountryName").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>Pricing</strong><br>
            &pound;</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%= Request.Form("DealPrice")%>&nbsp;<%=(rsPricingType.Fields.Item("PricingTypeTitle").Value)%> </font> <div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Holiday
              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")%>&nbsp;<% = (MonthName(Request.Form("FirstDepDate_Month")))%>&nbsp;<% = Request.Form("FirstDepDate_Year")%>
            to
            <% = Request.Form("LastDepDate_Day")%>&nbsp;<% = (MonthName(Request.Form("LastDepDate_Month")))%>&nbsp;<% = Request.Form("LastDepDate_Year")%>
            <br>
            </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Description</strong></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("AdditionalInfo")%>
            <br>
            <strong>Restrictions/Who is elegible<br>
            </strong></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
            <% = Request.Form("Restrictions")%>
            &nbsp;</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"><%=(rsTourOperatorDetails.Fields.Item("CompanyName").Value)%></div></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td class="SmallText"><%=(rsTourOperatorDetails.Fields.Item("CompanyAddress1").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText"><%=(rsTourOperatorDetails.Fields.Item("CompanyAddress2").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText"><%=(rsTourOperatorDetails.Fields.Item("CompanyAddress3").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText"><%=(rsTourOperatorDetails.Fields.Item("CompanyAddress4").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText">Tel: <%=(rsTourOperatorDetails.Fields.Item("CompanyTel").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText">Fax: <%=(rsTourOperatorDetails.Fields.Item("CompanyFax").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText">Email: <%=(rsTourOperatorDetails.Fields.Item("CompanyEmail").Value)%></td>
                </tr>
                <tr>
                  <td class="SmallText"><div align="left">ABTA:<%=(rsTourOperatorDetails.Fields.Item("CompanyAbta").Value)%> / IATA:<%=(rsTourOperatorDetails.Fields.Item("CompanyIata").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">&nbsp;</td>
          <td valign="top" class="SmallText">&nbsp;</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("AdditionalInfo")%>
       <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-data" name="PreviewAd" id="PreviewAd">
          <strong>
          <input name="submit" type="button" onClick="javascript:history.back()" class="LinkButton" value="Go Back and Amend">
          <input name="submit2" type="submit" class="LinkButton" onClick="GP_popupConfirmMsg('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("AdditionalInfo")%>">
          <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>&nbsp;</p></td>
  </tr>
  <tr>
    <td> <!--#include file="../includes/footer_inc.asp" --> </td>
  </tr>
</table>
</body>
</html>
<%
rsCountryName.Close()
Set rsCountryName = Nothing
%>
<%
rsPricingType.Close()
Set rsPricingType = Nothing
%>
<%
rsTourOperatorDetails.Close()
Set rsTourOperatorDetails = Nothing
%>
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12638310
To me on this one?

FtB
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question