set rs2= Server.CreateObject("ADODB.Recordset")
sqlstr2="SELECT * from table where a='"&a&"'"
if starttime<>"" then
sqlstr2=sqlstr2 &" and date>=#"&starttime&"#"
end if
if endtime<>"" then
sqlstr2=sqlstr2 &" and date<=#"&endtime&"#"
end if
sqlstr2=sqlstr2 &" order by id desc"
rs2.open sqlstr2,cnn,1,1
set rs2= Server.CreateObject("ADODB.Recordset")
sqlstr2="SELECT * from table where a='"&a&"'"
if starttime<>"" then
sqlstr2=sqlstr2 &" and date>=#"&starttime&"#"
end if
if endtime<>"" then
sqlstr2=sqlstr2 &" and date<=#"&endtime&"#"
end if
sqlstr2=sqlstr2 &" order by id desc"
rs2.open sqlstr2,cnn,1,1