#22003/7/21 10:29:11
我以前做过一个类似的,你参考参考.
<%
action = Request.QueryString("action")
if action = "get_today" then
sql_time = "where datediff(d,f_ip_time,getdate()) = 0 "
elseif action = "get_thisweek" then
sql_time = "where datediff(ww,f_ip_time,getdate()) = 0 "
elseif action = "get_thismonth" then
sql_time = "where datediff(m,f_ip_time,getdate()) = 0 "
elseif action = "get_fromto" then
if Request.QueryString("start_time") <> "" then
sql_time = "where f_ip_time between '" & Request.QueryString("start_time") & " 00:00:00' and '" & Request.QueryString("to_date") &" "& FormatDateTime(now(),3) &"' "
else
sql_time = "where datediff(d,f_ip_time,'" & Request.QueryString("to_date")& "') = 0 "
end if
elseif action = "get_iptype" then
sql_time = "where f_ip_type = '" & Request.QueryString("type") & "' "
else
sql_time = ""
end if
set rs=server.CreateObject("Adodb.Recordset")
sql = "select * from tb_ip " &sql_time& "order by f_ip_time desc"
'Response.Write(SQL)
'response.End()
rs.open sql,conn,1,1
%>