hi there,
i'm trying to create times in 20 min intervals on an asp page and then
check them against a date/time field(vbshortTime) in an access mdb. if the
time doesnt match as it loops through the recordset the time is printed.
Problem is it works with some times eg..9:40 but not with
others...eg..7:40...is this a delimiter
problem with the created times or something...heres the code....any help
would be appreciated...
timeview.asp:....(i think the problem is either the default value of
X("7:00") or the check line...if X = RS.Fields("time") then..)
<%
dim Conn, cStr, sql, RS
Set Conn = Server.CreateObject("ADODB.Connection")
cStr = "DRIVER={Microsoft Access Driver (*.mdb)};"
cStr = cStr & "DBQ=" & Server.MapPath("\genetic\cars.mdb") & ";"
Conn.Open(cStr)
sql = "select * from TIMES where [date] = #" & request("DateSelector") & "#"
Set RS = Conn.Execute(sql)
%>
<html>
<head>
</head>
<body bgcolor=white>
<TABLE WIDTH=100% HEIGHt=50%>
<TR>
<TD WIDTH=100% HEIGHT=100% ALIGN=left VALIGN=top>
<form name="details" action="/genetic/booktime.asp">
<p>DATE
<input name="datechosen" type="text" value='<% Response.Write
request("DateSelector")%>'> <br>
NAME <input name="Name" type="text"><br>
PHONE NO:<input name="phone" type="text"><br>
TIME-SLOT<select name="TimeSelector">
<option selected> Choose Time</option>
<%
dim flag
dim cnt
dim X
X = "7:00"
cnt = 36
If RS.EOF Then
do while int
cnt=cnt-1
X = dateAdd("n", 20, X ) %>
<option><% Response.Write X %></option>
<% loop
Else
do while cnt
flag = true
cnt = cnt-1
X = dateAdd("n", 20, X )
RS.MoveFirst
do while Not RS.EOF
if X = RS.Fields("time") Then
flag = false
Exit Do
end if
RS.MoveNext
loop
if flag = true then %>
<option><% Response.Write X %></option>
<% end if
loop
end if
RS.Close
Conn.Close %>
</select><br></p>
<input type="submit" value="Book!" name="submit">
</form>
</TD>
</TR>
</TABLE>
</body>
</html>
the booktime asp code is: ( this appears to work fine and adds records
accordingly)
<%
dim Conn, cStr, sql, RS, myvar
Set Conn = Server.CreateObject("ADODB.Connection")
cStr = "DRIVER={Microsoft Access Driver (*.mdb)};"
cStr = cStr & "DBQ=" & Server.MapPath("\genetic\cars.mdb") & ";"
Conn.Open(cStr)
sql = "select * from TIMES"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open sql, Conn, 3, 2, 1
RS.AddNew
RS("date") = request("datechosen")
RS("name") = request("name")
RS("phone") = request("phone")
RS("time") = request("TimeSelector")
RS.Update
RS.Close
Conn.Close
Response.Redirect "datefiller.asp"
%>