[thelist] ASP and SQL and dates

Lightening oktellme at earthlink.net
Fri Aug 15 08:27:35 CDT 2003


This is similar to a question I asked earlier except that was an integer,
this is a date. You guys recommended CInt (which fixed it) back then, so I
tried CDate now, with no result. This code finds no records, although there
are records there.

Can som one help me with this?

thanks, Laura
________________________________________________


<% ' this routine fills in holidays
dim dsn
dim sql
dim rsHoliday

 dsn="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\inetpub\wwwroot\WhiteLightening\db\buzz.mdb;Persist Security
Info=False"

  sql="SELECT HolidayId, HolidayName,  TimeOpen, TimeClose, HDate " &_
" from HolidayTable where hdate >=" & cdate(firstDateOfMonth) & " and hdate
<= " & cdate(lastDateOfMonth)

set rsHoliday=Server.CreateObject("ADODB.RecordSet")
'set cursor location
rsHoliday.cursorlocation=adUseClient

rsHoliday.Open sql,dsn

if rsHoliday.eof then
 response.write "<font align=center  color='#55eeee' >No Holidays were found
between " &_
   firstDateOfMonth &  " and " & lastDateOfMonth &_
     "</font><br>"

else

while not rsHoliday.EOF
 response.write rsHoliday.Fields("HolidayName").value  & " " &
rsHoliday.Fields("hdate").value  & "<br>"
 rsHoliday.movenext
wend
end if

rsHoliday.close
set rsHoliday=nothing

%>




More information about the thelist mailing list