%
pageP=request("page")
if(pageP <> "")then
sql1=session("sql")
sql=sql1
else
sql="select * from n_news where ( fabu1=1 or fabu2=1 or fabu3=1) "
title=request("title")
content=request("content")
newsfrom=request("newsfrom")
diqucode=request("diqucode")
ntype=request("ntype")
starttime=request("starttime")
endtime=request("endtime")
if(starttime <> "" )then
starttime=starttime&" 0:00:01"
end if
if(endtime <> "")then
endtime=endtime&" 23:59:59"
end if
if title <>"" then
sql=sql &" and title like '%"&title&"%'"
end if
if content <> "" then
sql=sql& " and content like '%"&content&"%'"
end if
if newsform <> "" then
sql=sql& " and newsform like '%"&newsform&"%'"
end if
if diqucode <> "0" then
d=session("diqucode")
diqucode1=left(d,4)
if(Instr(diqucode1,"37") <> 0)then
sql=sql&" and left(z_code,4)='"&diqucode1&"'"
else
sql=sql&" and z_code='"&d&"'"
end if
end if
if(starttime <> "" and endtime <> "")then
sql=sql&" and datetime >='"&starttime&"' and datetime <='"&endtime&"'"
else if(starttime<>"" and endtime ="")then
sql=sql&" and datetime >='"&starttime&"'"
else if(starttime ="" and endtime <>"")then
sql=sql&" and datetime <='"&endtime&"'"
end if
end if
end if
if ntype <> "0" then
sql=sql& "and l_code='"&ntype&"'"
end if
sql=sql & " and isopen='0' "
sql=sql & " order by datetime desc,jibie asc"
'response.Write(sql)
session("sql")=sql
end if
'response.Write(sql)
rs.open sql,conn,1,3
%>