以下是引用yms123在2007-3-25 18:33:40的发言:
if request.QueryString("act")="sos" then
if request.Form("so")=""and request.Form("stype")="全部" then
sql="select * from yingsiku order by y_date desc,y_time desc"
session("tsql")=sql
elseif request.Form("so")="" and request.Form("stype")<>"全部" then
sql="select * from yingsiku where y_type='"&request.Form("stype")&"' order by y_date desc,y_time desc"
session("tsql")=sql
elseif request.Form("so")<>"" and request.Form("stype")="全部" then
sql="select * from yingsiku where y_name like '%"&request.Form("so")&"%' order by y_date desc,y_time desc"
session("tsql")=sql
else
sql="select * from yingsiku where y_name like '%"&request.Form("so")&"%' and y_type='"&request.Form("stype")&"' order by y_date desc,y_time desc"
end if
if session("tsql")<>"" Then
sql=session("tsql")
else
session("tsql")=sql
end if
rst1.open sql,conn,1,1
这样写也不行吗?
if request.QueryString("act")="sos" then
if request.Form("so")=""and request.Form("stype")="全部" then
sql="select * from yingsiku order by y_date desc,y_time desc"
session("tsql")=sql
elseif request.Form("so")="" and request.Form("stype")<>"全部" then
sql="select * from yingsiku where y_type='"&request.Form("stype")&"' order by y_date desc,y_time desc"
session("tsql")=sql
elseif request.Form("so")<>"" and request.Form("stype")="全部" then
sql="select * from yingsiku where y_name like '%"&request.Form("so")&"%' order by y_date desc,y_time desc"
session("tsql")=sql
else
sql="select * from yingsiku where y_name like '%"&request.Form("so")&"%' and y_type='"&request.Form("stype")&"' order by y_date desc,y_time desc"
end if
if session("tsql")<>"" Then
sql=session("tsql")
else
session("tsql")=sql
end if
rst1.open sql,conn,1,1
这样写也不行吗?
是的,一样的结果