ASP按时间段查询

来源:百度知道 编辑:UC知道 时间:2024/04/29 19:50:21
查询条件1:所有人/用户1/用户2
查询条件2:所有时间/一天内/一周内/一个月内/半年内/一年内
数据库中时间字段数据类型为:日期/时间用的是系统时间now()
给出完整代码的,测试成功后,奖励500分!
不知道有没有说清楚,不太懂意思的可以直接QQ我:9013055

<%
Server.ScriptTimeOut = 500

acc = request("acc")
if acc = "a" then

on error resume next
dim conn,connstr,db
'更改数据库名字
db="数据库"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr

r1 = request.Form("r1")
r2 = request.Form("r2")

if r1 = alltime then
tiao1 = ""
end if
if r1 = "user1" then
tiao1 = "用户1"
end if
if r1 = "user2" then
tiao1 = "用户2"
end if

if r2 = "alltime" then
tiao2 = "0"
end if
if r2 = "one_data" then
tiao2 = 1
end if
if r2 = "week" then
tiao2 = 7
end if
if r2 = "half_year" then
tiao2 = 183
end if