Ask a Question related to ASP Database, Design and Development.
-
Ken Schaefer #1
Re: If date is taken already
Why not do something like this?
<%
dteStartTime = Request.Form("txtStartTime")
dteEndTime = Request.Form("txtEndTime")
If not isDate(dteStartTime) then
' Error
End If
If not isDate(dteEndTime) then
' Error
End If
strSQL = _
"SELECT COUNT(*) " & _
"FROM Bookings " & _
"WHERE " & dteStartTime & " <= EndTime " & _
"AND " & dteEndTime & " >= StartTime"
' Open connection here
objConn.Open blah blah
Set objRS = objConn.Execute(strSQL)
If objRS.EOF then
' overlapping booking
' error
Else
' not overlapping booking
End If
%>
Cheers
Ken
"Julie" <anonymous@discussions.microsoft.com> wrote in message
news:EE8EF5F2-4ED4-4628-9B95-EEE7AFFE3218@microsoft.com...
: Hello, I'm using Access 2002 and I want someone to enter a date and time
from a webform and have that data checked against the database to see if it
is available. Below is some code that I'm using, but it isn't working
correctly. TIA
:
: ' get the number of records
: SQL2 = "SELECT COUNT(id) FROM table"
: Set RS2 = server.createobject("ADODB.Recordset")
: set RS2=conn.execute(SQL2)
: y = RS2.Fields(0)
: last = y - 1
:
: ' select all but the last record entered
: SQL = "SELECT TOP " & last & " * FROM table ORDER BY id"
: Set RS = server.createobject("ADODB.Recordset")
: set RS=conn.execute(SQL)
:
: ' sort records by Desc order
: SQL8 = "SELECT id FROM table ORDER BY id DESC"
: Set RS8 = server.createobject("ADODB.Recordset")
: set RS8=conn.execute(SQL8)
: l = RS8.Fields(0)
:
: ' select the last record
: SQLlast = "SELECT datereq, timereq, endtime FROM truck WHERE id = " & l
: Set RSl = server.createobject("ADODB.Recordset")
: Set RSl = conn.execute(SQLlast)
:
: ' Below is the loop that isn't working ???
:
: While not RS.EOF
:
: If RSl.Fields("datereq") = RS.Fields("datereq") AND RSl.Fields("timereq")Then>= RS.Fields("timereq") AND RSl.Fields("timereq") < RS.Fields("endtime")
:
: Response.Write("That time is unavailable! " &
TimeWithoutSeconds(RS.Fields("timereq")) & " " &
TimeWithoutSeconds(RS.Fields("endtime")) & " is already scheduled!" &
"<br>")
: SQLDel = "DELETE FROM table WHERE id =" & x
: conn.execute(SQLDel)
: Response.Write "<" & "script language='JavaScript'>" & _
: "window.alert("" Start Time is unavailable! ""); " & _
: "history.go(-1); " & _
: "</script>"
:
: Else
:
: Response.Write(RS.Fields("datereq") & " ")
: Response.Write(" ")
:
: If RS.Fields("leave") = false Then
: Response.Write(TimeWithoutSeconds(RS.Fields("timer eq")))
: Response.Write(" " &
TimeWithoutSeconds(RS.Fields("endtime")) & "<br>")
: Else
: Response.Write("Time Not Available.")
: End If
:
: End If
:
: RS.MoveNext
: WEnd
:
Ken Schaefer Guest
-
JSObject returns wrong date. How can Iextract correct date from digital signature?
I'm trying to extract name and date from digital signatures by using JSObject in Excel VBA, but JSObject returns wrong date. Year, month, hour and... -
#39245 [NEW]: date function generate wrong date with 1162083600 timestamp
From: lohner at aldea dot hu Operating system: Linux PHP version: 5.1.6 PHP Bug Type: Date/time related Bug description: ... -
Convert date/time to date in SQL Server 2000 statement
Can this be done? tia -
converting date into database date format(newbie)
Hi! U can convert "8-Aug-03" into mysql date which requires yyyy-mm-dd format as below. <?php date("Y-m-d",strtotime("8-Aug-03")); ?> -
How do I manipulate a date variable to a specific date array?
Hi, I use the getdate() function to return today's date in an array. I do this as I need to separate the day/month/year as to display them in a...



Reply With Quote

