
Compare date in form with date/time in form with date/time in database
I was just wondering there is an easy way to compare a date submitted
from a from with a date already in my database. I have tried to
convert the Date which is a variant to Date Format but I am not getting
the response that I need. date1 is a Short Date in my Access database.
Any suggestions.
Here is the VB Script
<%
dim objDB
dim sSql
dim rsCal
dim oRs
dim subDate1
dim subEvent
dim subTime1
dim subVenue
dim subComments
subDate1 = Request.Form ("Date")
subEvent = Request.Form ("Event")
subTime1 = Request.Form ("Time")
subVenue = Request.Form ("Venue")
subComments = Request.Form ("Comments")
Response.buffer = "True"
set objDB=Server.CreateObject("ADODB.Connection")
objDB.Open "f1999g01"
objDB.BeginTrans
set rsCal=Server.CreateObject("ADODB.Recordset")
rsCal.Open "EventLog", objDB, adOpenForwardOnly, adLockOptimistic,
adCmdTable
sSql = "Select * From EventLog where date1 =" &CDate(subDate1)&" ;"
set oRs = objDB.Execute (sSql)
if isNull(oRs) then
If subDate1 <> "" and subEvent <> "" and subTime1 <> "" and
subVenue <>
"" Then
rsCal.AddNew
rsCal("date1") = CDate(subDate1)
rsCal("event") = subEvent
rsCal("time1") = CDate(subTime1)
rsCal("venue") = subVenue
rsCal("comments") = subComments
rsCal.Update
Response.redirect("addSucCal.asp")
else
Response.redirect("CalIncorrect.asp")
End if
else
Response.redirect("addUnsucCal.asp")
'No matter what I do I am always redirected to this page
end if
rsCal.Close
objDB.Close
%>
Sent via Deja.com http://www.*-*-*.com/
Before you buy.