if request("neirong")<>"" and request("riqi1")=""then
sql="select * from renyuan where id="&request("id")&" and "&request("tiaojian")&"='"&request("neirong")&"'"
elseif request("neirong")="" and request("riqi1")<>"" and request("riqi2")<>"" then
sql="select * from renyuan where id="&request("id")&" and shengri between #"&request("riqi1")&"# and #"&request("riqi2")&"#"
elseif request("neirong")<>"" and request("riqi1")<>"" and request("riqi2")<>"" then
sql="select * from renyuan where id="&request("id")&" and "&request("tiaojian")&"='"&request("neirong")&"'and shengri between #"&request("riqi1")&"# and #"&request("riqi2")&"#"
end if
---------------------------------------------------------
搞的那么麻烦,,,
Dim TempNR,RQ1,RQ2,TempID,TempSQL,TempTJ
TempNR=Trim(Request.From("neirong"))
RQ1=Trim(Request.From("riqi1"))
RQ2=Trim(Request.From("riqi2"))
TempID=Trim(Request.From("ID"))
TempTJ=Trim(Request.From("tiaojian"))
TempSQL="select * from renyuan where ID="&TempID&""
If TempNR<>"" Then '内容不为空
TempSQL=TempSQL&" AND "&TempTJ&"="&TempNR&""
End If
If RQ1<>"" And RQ2<>"" Then
TempSQL=TempSQL&" AND shengri between #"&RQ1&"# AND #"&RQ2&"#"
End If
Response.Write TempSQL '输出SQL语句,检查一下是否符合需求.
那啥,下次,把自己的代码整理整理,,乱...