主题:  请教一个asp里sql操作日期的问题

yeilong

职务:普通成员
等级:1
金币:0.0
发贴:188
#12004/7/18 10:05:10
t=request.form("year")&"-"&request.form("month")&"-"&request.form("day")&" 00:00:00"
t1=request.form("year1")&"-"&request.form("month1")&"-"&request.form("day1")&" 23:59:59"
else
t1=request("t1")
t=request("t")
end if
t=cdate(t)
t1=cdate(t1)
if t1<>"" then
sql0=sql0&" and (date between "&t&" and "&t1&" )"
end if

帮忙看看哪出错了

编辑历史:[此帖最近一次被 allinhands 编辑过(编辑时间:2004-07-18 11:32:16)]


yeilong

职务:普通成员
等级:1
金币:0.0
发贴:188
#22004/7/18 10:21:33
if request.form("year")<>"" then
t=request.form("year")&"-"&request.form("month")&"-"&request.form("day")&" 00:00:00"
t1=request.form("year1")&"-"&request.form("month1")&"-"&request.form("day1")&" 23:59:59"
else
t1=request("t1")
t=request("t")
end if
t=cdate(t)
t1=cdate(t1)
if t1<>"" then
sql0=sql0&" and ([date] between "&t&" and "&t1&" )"
end if



mlzboy

职务:普通成员
等级:2
金币:2.0
发贴:317
#32004/7/20 9:31:53
日期两边access里应该加#吧



celanyhsj

职务:普通成员
等级:1
金币:0.0
发贴:8
#42004/7/21 0:23:19
t=request.form("year"&"-"&request.form("month"&"-"&request.form("day"&" 00:00:00"
t1=request.form("year1"&"-"&request.form("month1"&"-"&request.form("day1"&" 23:59:59"

if ……then
……
else

if request.form("year"<>"" then
…………
else
t1=request("t1"
t=request("t"
end if
t=cdate(t)
t1=cdate(t1)
if t1<>"" then
sql0=sql0&" and ([date] between "&t&" and "&t1&" )"
end if