日期:2014-05-16  浏览次数:20839 次

asp 页面 无法使用日期查询数据,请大侠帮忙。。
asp 页面  无法使用日期查询数据,请大侠帮忙。。

我的页面原先使用access 数据库的,现在升级到SQL SERVER2000了。现就不能按输入的日期来查询了。

无法使用日期查询数据,

积分不多,请大侠帮忙。。

<% 
....
....
dim sql
dim rs
sql="select * from Productsqt where (zb2 = '台州') and zt=1 and  wanchen=0"

if DataBaseType=1 then
if isdate(StartTime) then  sql=sql&" and UpdateTime>=#" & StartTime & "#"
if isdate(EndTime) then  sql=sql&" and UpdateTime<=#" & EndTime & "#"
else
if isdate(StartTime) then  sql=sql&" and UpdateTime>=#" & StartTime & "#"
if isdate(EndTime) then  sql=sql&" and UpdateTime<=#" & EndTime & " 23:59:59#"
end if

if keyword<>"" Then 
    sql=sql & " and " & stype & " like '%" & keyword & "%'"
else
if BigClassName<>"" then
sql=sql & " and BigClassName='" & BigClassName & "' "
if SmallClassName<>"" then
sql=sql & " and SmallClassName='" & SmallClassName & "' "
end if
else
if SpecialName<>"" then
sql=sql & " and SpecialName='" & SpecialName & "' "
end if
end if
end if

sql=sql & " order by articleid desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
..............
.................
.................
.................

<table width="837" border='0' align=center cellpadding='2' cellspacing='1' class='border'>
        <form action="" method="get" name="search" id="Form">
          <input name="Action2" type="hidden" value="Unfinished">
          <tr class='Navigationtdbg'>
            <td width="783"><strong>开始时间:</strong>
                <input type='text' autocomplete=off  name='StartTime' size='12' maxlength='12' value='<%=StartTime%>'>
                <img src='../IMAGEs/calendar.gif' border='0' style='cursor:hand' onClick="popUpcalendar(this, search.StartTime, 'yyyy-mm-dd');" align=absmiddle><strong> 结束:</strong>
                <input type='text' autocomplete=off  name='EndTime' size='12' maxlength='12' value='<%=EndTime%>'>
                <img src='../IMAGEs/calendar.gif' border='0' style='cursor:hand' onClick="popUpcalendar(this, search.EndTime, 'yyyy-mm-dd');" align=absmiddle> <s