搜索日期条件怎么写

zzs_2013 2004-11-26 02:30:00
<input type="text" name="search_content">时间范围:
<select name="search_time">
<option value="1">所有</option>
<option value="2">1天内</option>
<option value="3">3天内</option>
<option value="4">7天内</option>
<option value="5">15天内</option>
</select>
数据库中对应的该查询字段为login_time条件怎么写啊?
...全文
124 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zzs_2013 2004-11-26
已经解决!给分!
回复
lienzhu 2004-11-26

<input type="text" name="search_content">时间范围:
<select name="search_time">
<option value="0">所有</option>
<option value="1">1天内</option>
<option value="3">3天内</option>
<option value="7">7天内</option>
<option value="15">15天内</option>
</select>
数据库中对应的该查询字段为login_time条件怎么写啊?

search_content = Request.Form("search_content")
if search_content<>"" and isnumeric(search_content) then
search_content=-1*int(search_content)
if search_content=0 then
sql="select * from tname"
else
'sql server数据库
sql="select * from tname where login_time>'" & dateadd('d',date,search_content) & "'"
'acess
' sql="select * from tname where login_time>#" & dateadd('d',date,search_content) "#"
end if
end if
回复
wangjinmin1982 2004-11-26
学习中~~~

回复
tatty_bad 2004-11-26
Good
比较即得!
回复
ljupin 2004-11-26
Dim search_content
search_content = Request.Form("search_content")

sql = "Select * From [TalbeName]"
Select Case search_content
Case 5
sql = sql & " Where (Date()-login_time) <= 15"
Case 4
sql = sql & " Where (Date()-login_time) <= 7"
Case 3
sql = sql & " Where (Date()-login_time) <= 3"
Case 2
sql = sql & " Where (Date()-login_time) <= 1"
End Select
回复
davs 2004-11-26
sql="select * from table "
login_time=request.form("search_time")
select case login_time
case 2:sql=sql&" where login_time>dateadd(d,-1,login_time)"
case 3:sql=sql&" where login_time>dateadd(d,-3,login_time)"
case 4:sql=sql&" where login_time>dateadd(d,-7,login_time)"
case 5:sql=sql&" where login_time>dateadd(d,-15,login_time)"
end select


回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-11-26 02:30
社区公告
暂无公告