请教:起始与截止时间相同时的查找问题
部分代码如下:
starttime=cRequest("starttime")
endtime=cRequest("endtime")
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select ID,ClassID,Title,KeyWords,FromName,Times from tblBulletin where (ToID<>'' or ToAll=1 or toDepartment="& Department &" )"
if starttime<>"" or endtime<>"" then
if starttime=endtime then
sql=sql&" and times like '"& starttime &"%'"
else
if starttime="" then starttime="1900-01-01"
if endtime="" then endtime=now()
sql=sql&" and times >= '"& starttime &"'and times <= '"&endtime&"'"
end if
end if
....
<td colspan="2">发布时间: 起始<input type="text" name="StartTime" value="<%=StartTime%>" class="input" size=10>
截止
<input type="text" name="EndTime" value="<%=EndTime%>" class="input" size=10>
(yyyy-mm-dd)</td>
。。。
如果我的starttime和endtime的值相同如都是“2003-6-9”,我想要的结果是查找2003-6-9日发布的所有公告,
可是按照以上的办法取出来的记录术却总是0,请问代码该怎么改正?(数据库中times字段为datetime类型)