My page is suppose to be a form that allows the user to input information that will transfer to the access table once the submit button is pressed.
I am receiving the following error message and I can't figure out what I've done wrong
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
My code is as follows:
<!--#include file= "heading.inc" -->
<!-- #include file= "conx.inc" -->
<html>
<head>
<title> Book Reservation </title>
</head>
<body>
<script language="javascript">
document.write("<Font color='white'>")
</script>
<STYLE type="text/css"> <!-- body {background: url(pictures/glr.gif) fixed;} --></STYLE>
<h1 align="center"> <b>Reserve a Suite </b></h1> <br>
<% if (request.form("frmlname")= "" or _
request.form("frmfname")= "" or _
request.form("frmaddress")= "" or _
request.form("frmcity")= "" or _
request.form("frmstate")= "" or _
request.form("frmzip")= "" or _
request.form("frmphone")= "" or _
request.form("frmcheckin")= "" or _
request.form("frmcheckout")= "" or _
request.form("frmnonights")= "" or _
request.form("frmacctnum")= "" or _
request.form("frmexpiration")= "" or _
request.form("frmsmoking")= "") then %>
<form method="post">
<table border="0" align="center" width= "350">
<tr> <td>First Name </td>
<td>
<input type="text" name="lname" size="20">
</td> </tr>
<tr> <td>Last Name </td>
<td>
<input type="text" name="fname" size="20">
</td> </tr>
<br> <br>
<tr> <td>Address </td>
<td>
<input type="text" name="address" size="30">
</td> </tr>
<br> <br>
<tr> <td>City </td>
<td>
<input type="text" name="city" size="15">
</td> </tr>
<tr> <td>State </td>
<tr>
<td class="labelsQuickSearch" >
<select name="as_state" size="1" class="labelsQuickSearch">
<option value="">Select a State
<option value="AL">Alabama
<option value="AK">Alaska
<option value="AZ">Arizona
<option value="AR">Arkansas
<option value="CA">California
<option value="CO">Colorado
<option value="CT">Connecticut
<option value="DE">Delaware
<option value="DC">District of Columbia
<option value="FL">Florida
<option value="GA">Georgia
<option value="ID">Idaho
<option value="IL">Illinois
<option value="IN">Indiana
<option value="IA">Iowa
<option value="KS">Kansas
<option value="KY">Kentucky
<option value="LA">Louisiana
<option value="ME">Maine
<option value="MD">Maryland
<option value="MA">Massachusetts
<option value="MI">Michigan
<option value="MN">Minnesota
<option value="MS">Mississippi
<option value="MO">Missouri
<option value="MT">Montana
<option value="NE">Nebraska
<option value="NV">Nevada
<option value="NH">New Hampshire
<option value="NJ">New Jersey
<option value="NM">New Mexico
<option value="NY">New York
<option value="NC">North Carolina
<option value="ND">North Dakota
<option value="OH">Ohio
<option value="OK">Oklahoma
<option value="OR">Oregon
<option value="PA">Pennsylvania
<option value="RI">Rhode Island
<option value="SC">South Carolina
<option value="SD">South Dakota
<option value="TN">Tennessee
<option value="TX">Texas
<option value="UT">Utah
<option value="VT">Vermont
<option value="VA">Virginia
<option value="WA">Washington
<option value="WV">West Virginia
<option value="WI">Wisconsin </tr> </td>
<tr> <td>Zip Code </td>
<td>
<input type="numeric" name="zip" size="7" maxlength="7">
</td> </tr>
<br><br>
<tr> <td>Phone Number </td>
<td>
<input type="text" name="phone" size="12" maxlength="12">
</td> </tr>
<br> <br> <br>
<tr> <td>No. of Nights</td>
<td>
<input type="numeric" value= "0" name="nonights" size="2" maxlength="2">
</td> </tr>
<br> <br>
<tr> <td>Check in Date</td> </tr>
<tr class="labelsQuickSearch">
<td class="labelsQuickSearch">
<select name="p_amonth" class="labelsQuickSearch" size="1">
<option value="JAN"> Jan
<option value="FEB"> Feb
<option value="MAR"> Mar
<option value="APR" SELECTED > Apr
<option value="MAY"> May
<option value="JUN"> Jun
<option value="JUL"> Jul
<option value="AUG"> Aug
<option value="SEP"> Sep
<option value="OCT"> Oct
<option value="NOV"> Nov
<option value="DEC"> Dec </tr> </td>
</select>
<select name="p_aday" class="labelsQuickSearch" size="1">
<option value="01"> 1
<option value="02"> 2
<option value="03"> 3
<option value="04"> 4
<option value="05"> 5
<option value="06"SELECTED> 6
<option value="07"> 7
<option value="08"> 8
<option value="09"> 9
<option value="10"> 10
<option value="11"> 11
<option value="12"> 12
<option value="13"> 13
<option value="14"> 14
<option value="15"> 15
<option value="16"> 16
<option value="17"> 17
<option value="18"> 18
<option value="19"> 19
<option value="20"> 20
<option value="21"> 21
<option value="22"> 22
<option value="23"> 23
<option value="24"> 24
<option value="25"> 25
<option value="26"> 26
<option value="27"> 27
<option value="28"> 28
<option value="29"> 29
<option value="30"> 30
<option value="31"> 31
</select>
<input type=hidden name="p_ayear" value="2004">
<!-- <select name="p_ayear" class="null" size="1" class="labelsQuickSearch"> -->
<option value="2004" SELECTED > 2004
</select>
<br> <br>
<tr> <td>Check out Date</td> </tr>
<tr class="labelsQuickSearch">
<td class="labelsQuickSearch">
<select name="p_amonth" class="labelsQuickSearch" size="1">
<option value="JAN"> Jan
<option value="FEB"> Feb
<option value="MAR"> Mar
<option value="APR" SELECTED > Apr
<option value="MAY"> May
<option value="JUN"> Jun
<option value="JUL"> Jul
<option value="AUG"> Aug
<option value="SEP"> Sep
<option value="OCT"> Oct
<option value="NOV"> Nov
<option value="DEC"> Dec
</select>
<select name="p_aday" class="labelsQuickSearch" size="1">
<option value="01"> 1
<option value="02"> 2
<option value="03"> 3
<option value="04"> 4
<option value="05"> 5
<option value="06"> 6
<option value="07"SELECTED> 7
<option value="08"> 8
<option value="09"> 9
<option value="10"> 10
<option value="11"> 11
<option value="12"> 12
<option value="13"> 13
<option value="14"> 14
<option value="15"> 15
<option value="16"> 16
<option value="17"> 17
<option value="18"> 18
<option value="19"> 19
<option value="20"> 20
<option value="21"> 21
<option value="22"> 22
<option value="23"> 23
<option value="24"> 24
<option value="25"> 25
<option value="26"> 26
<option value="27"> 27
<option value="28"> 28
<option value="29"> 29
<option value="30"> 30
<option value="31"> 31
</select>
<input type=hidden name="p_ayear" value="2004">
<!-- <select name="p_ayear" class="null" size="1" class="labelsQuickSearch"> -->
<option value="2004" SELECTED > 2004
</select>
<br> <br> <br>
<tr> <td>Smoking? </td>
<td>
<input type= "checkbox" name= "Yes" checked> Yes
<input type= "checkbox" name= "No"> No
</td> </tr>
<br> <br> <br>
<tr> <td>Credit Card Type:</td>
<td>
<Select name="Credit Card">
<option> Visa
<option> Mastercard
<option> Discover
<option> American Express
<option> Diner's Club
</select>
</td> </tr>
<br> <br>
<tr> <td>Account Number</td>
<td>
<input type="numeric" name="acctnum" size="16" maxlength="16">
</td> </tr>
<tr> <td> Expiration Date</td>
<td>
<input type="text" name="expiration" size="5" maxlength="5">
</td> </tr>
<br> <br> <br>
<div align="center">
<td> <input type="submit" value="Book it!">
</div>
</font>
<%
'get highest confirmationNum'
dim newConfNum
newConfNum = 100
dim sql
oC.open CS
sql="select * from HotelReservation"
oRS.open sql, oC
do until oRS.EOF
if(oRS("confirmationNum") > newConfNum) then
newConfNum = oRS("confirmationNum")
end if
oRS.movenext
loop
newConfNum = newConfNum + 1
sql="insert into HotelReservation values('" & _
request.form("frmlname") & "', '" & _
request.form("frmfname") & "', '" &_
request.form("frmaddress") & "', '" & _
request.form("frmcity") & "', '" & _
request.form("frmstate") & "', '" & _
request.form("frmzip") & "', '"& _
request.form("frmphone") & "', '" &_
request.form("frmcheckin") & "', '" & _
request.form("frmcheckout") & "', '" & _
request.form("frmnonights") & "', '" & _
request.form("frmcctype") & "', '" & _
request.form("frmacctnum") & "', '" & _
request.form("frmexpiration") & "', '" & _
request.form("frmsmoking") & "', '" & _
newConfNum &" ')"
oC.Execute sql
oC.close
set oC= nothing
response.redirect("reservation.asp")
end if%>
</html>
I am receiving the following error message and I can't figure out what I've done wrong
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
My code is as follows:
<!--#include file= "heading.inc" -->
<!-- #include file= "conx.inc" -->
<html>
<head>
<title> Book Reservation </title>
</head>
<body>
<script language="javascript">
document.write("<Font color='white'>")
</script>
<STYLE type="text/css"> <!-- body {background: url(pictures/glr.gif) fixed;} --></STYLE>
<h1 align="center"> <b>Reserve a Suite </b></h1> <br>
<% if (request.form("frmlname")= "" or _
request.form("frmfname")= "" or _
request.form("frmaddress")= "" or _
request.form("frmcity")= "" or _
request.form("frmstate")= "" or _
request.form("frmzip")= "" or _
request.form("frmphone")= "" or _
request.form("frmcheckin")= "" or _
request.form("frmcheckout")= "" or _
request.form("frmnonights")= "" or _
request.form("frmacctnum")= "" or _
request.form("frmexpiration")= "" or _
request.form("frmsmoking")= "") then %>
<form method="post">
<table border="0" align="center" width= "350">
<tr> <td>First Name </td>
<td>
<input type="text" name="lname" size="20">
</td> </tr>
<tr> <td>Last Name </td>
<td>
<input type="text" name="fname" size="20">
</td> </tr>
<br> <br>
<tr> <td>Address </td>
<td>
<input type="text" name="address" size="30">
</td> </tr>
<br> <br>
<tr> <td>City </td>
<td>
<input type="text" name="city" size="15">
</td> </tr>
<tr> <td>State </td>
<tr>
<td class="labelsQuickSearch" >
<select name="as_state" size="1" class="labelsQuickSearch">
<option value="">Select a State
<option value="AL">Alabama
<option value="AK">Alaska
<option value="AZ">Arizona
<option value="AR">Arkansas
<option value="CA">California
<option value="CO">Colorado
<option value="CT">Connecticut
<option value="DE">Delaware
<option value="DC">District of Columbia
<option value="FL">Florida
<option value="GA">Georgia
<option value="ID">Idaho
<option value="IL">Illinois
<option value="IN">Indiana
<option value="IA">Iowa
<option value="KS">Kansas
<option value="KY">Kentucky
<option value="LA">Louisiana
<option value="ME">Maine
<option value="MD">Maryland
<option value="MA">Massachusetts
<option value="MI">Michigan
<option value="MN">Minnesota
<option value="MS">Mississippi
<option value="MO">Missouri
<option value="MT">Montana
<option value="NE">Nebraska
<option value="NV">Nevada
<option value="NH">New Hampshire
<option value="NJ">New Jersey
<option value="NM">New Mexico
<option value="NY">New York
<option value="NC">North Carolina
<option value="ND">North Dakota
<option value="OH">Ohio
<option value="OK">Oklahoma
<option value="OR">Oregon
<option value="PA">Pennsylvania
<option value="RI">Rhode Island
<option value="SC">South Carolina
<option value="SD">South Dakota
<option value="TN">Tennessee
<option value="TX">Texas
<option value="UT">Utah
<option value="VT">Vermont
<option value="VA">Virginia
<option value="WA">Washington
<option value="WV">West Virginia
<option value="WI">Wisconsin </tr> </td>
<tr> <td>Zip Code </td>
<td>
<input type="numeric" name="zip" size="7" maxlength="7">
</td> </tr>
<br><br>
<tr> <td>Phone Number </td>
<td>
<input type="text" name="phone" size="12" maxlength="12">
</td> </tr>
<br> <br> <br>
<tr> <td>No. of Nights</td>
<td>
<input type="numeric" value= "0" name="nonights" size="2" maxlength="2">
</td> </tr>
<br> <br>
<tr> <td>Check in Date</td> </tr>
<tr class="labelsQuickSearch">
<td class="labelsQuickSearch">
<select name="p_amonth" class="labelsQuickSearch" size="1">
<option value="JAN"> Jan
<option value="FEB"> Feb
<option value="MAR"> Mar
<option value="APR" SELECTED > Apr
<option value="MAY"> May
<option value="JUN"> Jun
<option value="JUL"> Jul
<option value="AUG"> Aug
<option value="SEP"> Sep
<option value="OCT"> Oct
<option value="NOV"> Nov
<option value="DEC"> Dec </tr> </td>
</select>
<select name="p_aday" class="labelsQuickSearch" size="1">
<option value="01"> 1
<option value="02"> 2
<option value="03"> 3
<option value="04"> 4
<option value="05"> 5
<option value="06"SELECTED> 6
<option value="07"> 7
<option value="08"> 8
<option value="09"> 9
<option value="10"> 10
<option value="11"> 11
<option value="12"> 12
<option value="13"> 13
<option value="14"> 14
<option value="15"> 15
<option value="16"> 16
<option value="17"> 17
<option value="18"> 18
<option value="19"> 19
<option value="20"> 20
<option value="21"> 21
<option value="22"> 22
<option value="23"> 23
<option value="24"> 24
<option value="25"> 25
<option value="26"> 26
<option value="27"> 27
<option value="28"> 28
<option value="29"> 29
<option value="30"> 30
<option value="31"> 31
</select>
<input type=hidden name="p_ayear" value="2004">
<!-- <select name="p_ayear" class="null" size="1" class="labelsQuickSearch"> -->
<option value="2004" SELECTED > 2004
</select>
<br> <br>
<tr> <td>Check out Date</td> </tr>
<tr class="labelsQuickSearch">
<td class="labelsQuickSearch">
<select name="p_amonth" class="labelsQuickSearch" size="1">
<option value="JAN"> Jan
<option value="FEB"> Feb
<option value="MAR"> Mar
<option value="APR" SELECTED > Apr
<option value="MAY"> May
<option value="JUN"> Jun
<option value="JUL"> Jul
<option value="AUG"> Aug
<option value="SEP"> Sep
<option value="OCT"> Oct
<option value="NOV"> Nov
<option value="DEC"> Dec
</select>
<select name="p_aday" class="labelsQuickSearch" size="1">
<option value="01"> 1
<option value="02"> 2
<option value="03"> 3
<option value="04"> 4
<option value="05"> 5
<option value="06"> 6
<option value="07"SELECTED> 7
<option value="08"> 8
<option value="09"> 9
<option value="10"> 10
<option value="11"> 11
<option value="12"> 12
<option value="13"> 13
<option value="14"> 14
<option value="15"> 15
<option value="16"> 16
<option value="17"> 17
<option value="18"> 18
<option value="19"> 19
<option value="20"> 20
<option value="21"> 21
<option value="22"> 22
<option value="23"> 23
<option value="24"> 24
<option value="25"> 25
<option value="26"> 26
<option value="27"> 27
<option value="28"> 28
<option value="29"> 29
<option value="30"> 30
<option value="31"> 31
</select>
<input type=hidden name="p_ayear" value="2004">
<!-- <select name="p_ayear" class="null" size="1" class="labelsQuickSearch"> -->
<option value="2004" SELECTED > 2004
</select>
<br> <br> <br>
<tr> <td>Smoking? </td>
<td>
<input type= "checkbox" name= "Yes" checked> Yes
<input type= "checkbox" name= "No"> No
</td> </tr>
<br> <br> <br>
<tr> <td>Credit Card Type:</td>
<td>
<Select name="Credit Card">
<option> Visa
<option> Mastercard
<option> Discover
<option> American Express
<option> Diner's Club
</select>
</td> </tr>
<br> <br>
<tr> <td>Account Number</td>
<td>
<input type="numeric" name="acctnum" size="16" maxlength="16">
</td> </tr>
<tr> <td> Expiration Date</td>
<td>
<input type="text" name="expiration" size="5" maxlength="5">
</td> </tr>
<br> <br> <br>
<div align="center">
<td> <input type="submit" value="Book it!">
</div>
</font>
<%
'get highest confirmationNum'
dim newConfNum
newConfNum = 100
dim sql
oC.open CS
sql="select * from HotelReservation"
oRS.open sql, oC
do until oRS.EOF
if(oRS("confirmationNum") > newConfNum) then
newConfNum = oRS("confirmationNum")
end if
oRS.movenext
loop
newConfNum = newConfNum + 1
sql="insert into HotelReservation values('" & _
request.form("frmlname") & "', '" & _
request.form("frmfname") & "', '" &_
request.form("frmaddress") & "', '" & _
request.form("frmcity") & "', '" & _
request.form("frmstate") & "', '" & _
request.form("frmzip") & "', '"& _
request.form("frmphone") & "', '" &_
request.form("frmcheckin") & "', '" & _
request.form("frmcheckout") & "', '" & _
request.form("frmnonights") & "', '" & _
request.form("frmcctype") & "', '" & _
request.form("frmacctnum") & "', '" & _
request.form("frmexpiration") & "', '" & _
request.form("frmsmoking") & "', '" & _
newConfNum &" ')"
oC.Execute sql
oC.close
set oC= nothing
response.redirect("reservation.asp")
end if%>
</html>