Japskunk72
Programmer
I have an ASP page that will get 2 dates, a begining and an end date to grab info from a SQL database. the for next loop will not work, I do not know why it wont work. I am new to ASP. please help, here is my code followed my the error in IE 6.0
********************Code *********************************
<form method="get" action="WSCardDateReport.asp"><body>
First Date: <input type="text" name="firstdate"><br />
Last Date: <input type="text" name="lastdate"><br /><br />
<input type="submit" value="Submit">
<%@LANGUAGE="VBSCRIPT"%>
<%
firstdate=request.querystring("firstdate"
lastdate=request.querystring("lastdate"
Set adors = Server.CreateObject("ADODB.Recordset"
Set objConn = Server.CreateObject("ADODB.Connection"
dim firstdate,lastdate,sqlstate,datestamp,timestamp,receivedby,cname,address,street,zip
dim phone,section,remarks,complaint,complaintrelay,timerelay,relaytype
dim complaintLEN,realcomplaint,X1,complaintnum
objConn.Open="DSN=wwtpmain;uid=user;pwd=pass"
SQLState="Select * from Emergencycardsystem where [date] between '" & firstdate & "' and '" & lastdate & "' order by date"
set adors= objconn.execute(sqlstate)
Do while not adors.eof
DateStamp=adors("Date"
.value
TimeStamp=adors("time"
.value
Receivedby=adors("recievedby"
.value
cname=adors("cname"
.value
address=adors("caddress"
.value
street=adors("cstreet"
.value
zip=adors("czip"
.value
phone=adors("cphone"
.value
section=adors("csection"
.value
remarks=adors("remarks"
.value
complaint=adors("complaint"
.value
complaintrelay=adors("Complaint_relay"
.value
timerelay=adors("time_relay"
.value
relaytype=adors("relay_type"
.value
ComplaintLen= Len(complaint)
if complaintlen > 0 then
for x1 = 0 to complaintLEN
ComplaintNum = mid(complaint,x1)
Select Case ComplaintNum
Case 0
REalcomplaint = realcomplaint & "Water in Basement - Weather Related "
Case 1
realcomplaint = realcomplaint & "Var "
Case 2
realcomplaint = realcomplaint & "Var "
Case 3
realcomplaint = realcomplaint & "Var "
Case 4
realcomplaint = realcomplaint & "Var "
Case 5
realcomplaint = realcomplaint & "Var "
Case 6
realcomplaint = realcomplaint & "Var "
Case 7
realcomplaint = realcomplaint & "Var "
Case 8
realcomplaint = realcomplaint & "Var "
Case 9
realcomplaint = realcomplaint & "Var "
End Select
next x1
end if
%>
<div align="center">
<center>
<table border="2" cellspacing="1" height="1" width="558">
<tr>
<td height="27" width="99"><b>Date:</b><% response.write(datestamp) %> </td>
<td height="27" width="90"><b>Time:</b><%response.write(timestamp)%> </td>
<td height="27" width="256"><b>Relayed By:</b><%Response.write(Receivedby)%> </td>
<td height="27" width="320"><b>Time Relayed:</b><%response.write(timerelay)%> </td>
</tr>
<tr>
<td height="1" colspan="3" width="272" valign="top"><b>Caller Name:</b><%response.write(cname)%>
</td>
<td height="1" valign="middle" width="350"><b>Phone:<%response.write(phone)%>
</b>
</td> </tr> <tr>
<td height="26" colspan="4" width="628"><b>Address:</b> <%response.write(address & " "
%> <%response.write(street)%></td> </tr> <tr>
<td height="1" colspan="3" width="272" valign="top"><b>Forwarded to:</b> <%response.write(complaintrelay)%> </td>
<td height="1" width="350" valign="top"><b>Section:</b> <%response.write(section)%></td></tr> <tr>
<td height="19" colspan="4" width="622"><b>Problem:</b> <%response.write(realcomplaint)%></td> </tr> <tr>
<td height="19" colspan="4" width="622"><b>Remarks:</b><%response.write(remarks)%></td> </tr> </table> </center></div> <br><br>
<%
adors.movenext
loop
%>
</body>
</form>
********************Error*********************************
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/WSCardDateReport.asp, line 64, column 5
next x1
Thanks,
JT
********************Code *********************************
<form method="get" action="WSCardDateReport.asp"><body>
First Date: <input type="text" name="firstdate"><br />
Last Date: <input type="text" name="lastdate"><br /><br />
<input type="submit" value="Submit">
<%@LANGUAGE="VBSCRIPT"%>
<%
firstdate=request.querystring("firstdate"
lastdate=request.querystring("lastdate"
Set adors = Server.CreateObject("ADODB.Recordset"
Set objConn = Server.CreateObject("ADODB.Connection"
dim firstdate,lastdate,sqlstate,datestamp,timestamp,receivedby,cname,address,street,zip
dim phone,section,remarks,complaint,complaintrelay,timerelay,relaytype
dim complaintLEN,realcomplaint,X1,complaintnum
objConn.Open="DSN=wwtpmain;uid=user;pwd=pass"
SQLState="Select * from Emergencycardsystem where [date] between '" & firstdate & "' and '" & lastdate & "' order by date"
set adors= objconn.execute(sqlstate)
Do while not adors.eof
DateStamp=adors("Date"
TimeStamp=adors("time"
Receivedby=adors("recievedby"
cname=adors("cname"
address=adors("caddress"
street=adors("cstreet"
zip=adors("czip"
phone=adors("cphone"
section=adors("csection"
remarks=adors("remarks"
complaint=adors("complaint"
complaintrelay=adors("Complaint_relay"
timerelay=adors("time_relay"
relaytype=adors("relay_type"
ComplaintLen= Len(complaint)
if complaintlen > 0 then
for x1 = 0 to complaintLEN
ComplaintNum = mid(complaint,x1)
Select Case ComplaintNum
Case 0
REalcomplaint = realcomplaint & "Water in Basement - Weather Related "
Case 1
realcomplaint = realcomplaint & "Var "
Case 2
realcomplaint = realcomplaint & "Var "
Case 3
realcomplaint = realcomplaint & "Var "
Case 4
realcomplaint = realcomplaint & "Var "
Case 5
realcomplaint = realcomplaint & "Var "
Case 6
realcomplaint = realcomplaint & "Var "
Case 7
realcomplaint = realcomplaint & "Var "
Case 8
realcomplaint = realcomplaint & "Var "
Case 9
realcomplaint = realcomplaint & "Var "
End Select
next x1
end if
%>
<div align="center">
<center>
<table border="2" cellspacing="1" height="1" width="558">
<tr>
<td height="27" width="99"><b>Date:</b><% response.write(datestamp) %> </td>
<td height="27" width="90"><b>Time:</b><%response.write(timestamp)%> </td>
<td height="27" width="256"><b>Relayed By:</b><%Response.write(Receivedby)%> </td>
<td height="27" width="320"><b>Time Relayed:</b><%response.write(timerelay)%> </td>
</tr>
<tr>
<td height="1" colspan="3" width="272" valign="top"><b>Caller Name:</b><%response.write(cname)%>
</td>
<td height="1" valign="middle" width="350"><b>Phone:<%response.write(phone)%>
</b>
</td> </tr> <tr>
<td height="26" colspan="4" width="628"><b>Address:</b> <%response.write(address & " "
<td height="1" colspan="3" width="272" valign="top"><b>Forwarded to:</b> <%response.write(complaintrelay)%> </td>
<td height="1" width="350" valign="top"><b>Section:</b> <%response.write(section)%></td></tr> <tr>
<td height="19" colspan="4" width="622"><b>Problem:</b> <%response.write(realcomplaint)%></td> </tr> <tr>
<td height="19" colspan="4" width="622"><b>Remarks:</b><%response.write(remarks)%></td> </tr> </table> </center></div> <br><br>
<%
adors.movenext
loop
%>
</body>
</form>
********************Error*********************************
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/WSCardDateReport.asp, line 64, column 5
next x1
Thanks,
JT