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> <strong>查询:</strong>
<input name="keyword" type="text" id="keyword" size="25" />
<select name="stype" id="stype">
<option value="Product_Id" selected >工单流水号</option>
<option value="Content" >问题内容</option>
<option value="Memo" >回复内容</option>
<option value="SmallClassName">业务类型</option>
<option value="Unit">诉求产品</option>
<option value="Spec">提交人</option>
<option value="UpdateTime">录入日期</option>
</select>
<input name="Query2" type="submit" class="bntStyle" id="Query2" value="开 始 查 找" /></td>
</tr>
</form>
</table> asp sql autocomplete border input
[解决办法]
把#号改成'号.
[解决办法]
撸主其实可以把SQL语句在执行前输出到页面,然后复制这个语句去查询分析器执行一下,就知道是什么原因了