主题:时间段查询语句!
dim rs
dim sql
Fettle=request.form("Fettle")
txtitle=request.Form("txtitle")
Begintime=trim(request.Form("Begintime"))
Endtime=trim(request.Form("Endtime"))
if len(Begintime)=0 then
Begintime=year(now)&"-"& mm &"-01"
end if
if len(Endtime)=0 then
Endtime=thistoday
end if
set rs=server.createobject("adodb.recordset")
sql="select * from news where Title like '%"&request("txtitle")&"%' and Fettle like '%"&request("Fettle")&"%' and Infotime>='"&Begintime&"' and Infotime<='"&Endtime&"' order by NewsID asc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<br><br><p align='center'>对不起,没有您要查询的信息!</p>"
else
....
end if
我这个地方到底哪写错了 为什么查询不到数据 如果去掉and Infotime>='"&Begintime&"' and Infotime<='"&Endtime&"'就可以查询到title和fettle的数据 就是查询不到时间的数据
dim sql
Fettle=request.form("Fettle")
txtitle=request.Form("txtitle")
Begintime=trim(request.Form("Begintime"))
Endtime=trim(request.Form("Endtime"))
if len(Begintime)=0 then
Begintime=year(now)&"-"& mm &"-01"
end if
if len(Endtime)=0 then
Endtime=thistoday
end if
set rs=server.createobject("adodb.recordset")
sql="select * from news where Title like '%"&request("txtitle")&"%' and Fettle like '%"&request("Fettle")&"%' and Infotime>='"&Begintime&"' and Infotime<='"&Endtime&"' order by NewsID asc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<br><br><p align='center'>对不起,没有您要查询的信息!</p>"
else
....
end if
我这个地方到底哪写错了 为什么查询不到数据 如果去掉and Infotime>='"&Begintime&"' and Infotime<='"&Endtime&"'就可以查询到title和fettle的数据 就是查询不到时间的数据