quote:
I'd suggest commenting out that line for a moment and adding this line below it:
'conntemp.execute (mySQL)
Response.write(mySQL & "<br>")
I did that but didn't work... my response.write at the end is working but not the my SQL ...
I started back at the beginning. Page 1 (the form) looks like this:
<%
Dim conntemp, myDSN, myRS, mySQL, arrEquipment, arrQuantity, varDate1, varDate2
varDate1 = Request.Form("Date1")
varDate2 = Request.Form("Date2")
Set conntemp=Server.CreateObject("ADODB.Connection")
myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../fpdb/index.mdb")
conntemp.open myDSN
mySQL = "SELECT Equipment FROM tEvents WHERE ((#"&varDate1&"# Between Date1 And Date2) OR (#"&varDate2&"# Between Date1 And Date2))"
Set myRS = Server.CreateObject("ADODB.Recordset")
myRS.Open mySQL, conntemp, 0, 1
If myRS.eof OR myRS.bof then
RecordFound=0
Else
arrEquipment = myRS.GetString(,,,"<br>")
RecordFound=-1
End if
myRS.Close
Set myRS = nothing
conntemp.Close
Set conntemp = nothing
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Staff </title>
<meta name="Microsoft Theme" content="ice 011">
</head>
<body>
<%
If RecordFound <> 0 then
Response.Write ("")
else
Response.Write(arrEquipment)
End if
%>
<p>
</p>
<form method="POST" action="InsertQuery.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
<div align="left">
<b>Equipment Booking</b><br>
</div>
<div align="left">
<font size="1">
<input type="text" name="Date11" size="12" value="<%=varDate1%>" disabled>
(to change these dates click the back button on your browser)</div>
<input type="text" name="Date21" size="12" value="<%=varDate2%>" disabled> (mm/dd/year)<br>
<br>
Please select the equipment your are booking:<p>TS = at the SWO Admin Centre
- London</p>
<p>BF = at the Hamilton Centre <br>
</font><br>
<%If Instr(arrEquipment,"1") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Blue Display Unit")
Else
Response.write("<input type='checkbox' name='1' value='1'> Blue Display TS")
End IF%> <br>
<br>
<%If Instr(arrEquipment,"2") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Popcorn Machine TS")
Else
Response.write("<input type='checkbox' name='2' value='1'> Popcorn Machine TS")
End IF%><br>
<br>
<%If Instr(arrEquipment,"3") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Popcorn Machine BF1")
Else
Response.write("<input type='checkbox' name='3' value='1'> Popcorn Machine BF1")
End IF%><br>
<br>
<%If Instr(arrEquipment,"4") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Popcorn Machine BF2")
Else
Response.write("<input type='checkbox' name='4' value='1'> Popcorn Machine BF2")
End IF%><br>
<br>
<%If Instr(arrEquipment,"5") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Laminator")
Else
Response.write("<input type='checkbox' name='5' value='1'> Laminator")
End IF%><br>
<br>
<%If Instr(arrEquipment,"6") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Shelter 1")
Else
Response.write("<input type='checkbox' name='6' value='1'> Shelter 1")
End IF%><br>
<br>
<%If Instr(arrEquipment,"7") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Shelter 2")
Else
Response.write("<input type='checkbox' name='7' value='1'> Shelter 2")
End IF%><br>
<br>
<%If Instr(arrEquipment,"8") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Printer")
Else
Response.write("<input type='checkbox' name='8' value='1'> Printer")
End IF%><br>
<br>
<%If Instr(arrEquipment,"9") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Binding Machine 1")
Else
Response.write("<input type='checkbox' name='9' value='1'> Binding Machine 1")
End IF%><br>
<br>
<%If Instr(arrEquipment,"10") Then
Response.Write ("<img src='button2.gif' width='70' height='27'> Binding Machine 2")
Else
Response.write("<input type='checkbox' name='10' value='1'> Binding Machine 2")
End IF%><br>
<br>
<%
Response.write("<input type='text' name='Quantity1' size='4'> Tattoos")
%><br>
<br>
<br>
<%
Response.write("<input type='text' name='Quantity2' size='4'> Pamphlets - Beavers/Cubs")
%><br>
<%
Response.write("<input type='text' name='Quantity3' size='4'> Pamphlets - Scouts/Vent")
%><br>
<br>
<br>
<br>
<br>
<b>
<span style="font-weight: 700; font-size: 8pt"><font size="1">
<br>
</font></span><font size="1">
<br>
</font><span style="font-weight: 700; ">Contact information <br>
</span><span style="font-weight: 700; font-size: 8pt"> <font size="1">
<br>
Name: <!--webbot bot="Validation" s-display-name="Please select a name" b-value-required="TRUE" --><select size="1" name="Staff">
<option>Select Name</option>
<option>Debbie</option>
<option>Sarah</option>
<option>Lorne</option>
<option>John</option>
<option>Fran</option>
<option>Amy</option>
<option>Elizabeth</option>
<option>Danielle</option>
<option>Michelle</option>
<option>Grant</option>
<option>David</option>
<option>Cheryl</option>
<option>Marie-Claire</option>
</select> <font color="#FF0000"><br>
<br>
</font> <font color="#FF861F">Details (When will it be returned etc.)<br>
</font> <textarea rows="2" name="Details" cols="48"></textarea></p>
<p><input type="submit" value="Submit" name="Submit"></p>
<input type="hidden" name="Date1" value="<%=varDate1%>">
<input type="hidden" name="Date2" value="<%=varDate2%>">
<input type="hidden" name="Date_Added" size="20" value="<%=Now()%>">
</form>
</font></span></body>
</html>
The insert query looks like this now:
<%
DIM conntemp, mySQL, myDSN
myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../fpdb/index.mdb")
'myDSN would be specific to your environment
set conntemp=server.createobject("adodb.connection")
conntemp.open myDSN
FOR i = 1 to 10
IF Request("Equipment" & i) <> "" THEN
FOR a = 1 to 3
IF Request("Quantity" & a) <> "" THEN
mySQL = "INSERT INTO tEvents"
mySQL = mySQL & "(Date1, Date2 , Staff, Details, Equipment, Quantity)"
mySQL = mySQL & "VALUES(#" & Request.Form("Date1") & "#,"
mySQL = mySQL & "#" & Request.Form("Date2") & "#,"
mySQL = mySQL & "'" & Replace(Request.Form("Staff"),"'","''") & "',"
mySQL = mySQL & "'" & Replace(Request.Form("Details"),"'","''") & "',"
mySQL = mySQL & "" & Replace(Request.Form("Equipment" & i),"'","''") & ","
mySQL = mySQL & "" & Replace(Request.Form("Quantity" & a),"'","''") & ")"
'conntemp.execute (mySQL)
Response.write(mySQL & "<br>")
end if
next
END IF
NEXT
conntemp.close
set conntemp=nothing
Response.write "Thanks"
%><p> </p>