那么在實際中如何來實現(xiàn)這樣的多條件模糊查詢呢?我是這樣來實現(xiàn)的:
name=Request.QueryString("name") ’姓名
sex=Request.QueryString("sex") ’性別
call=Request.QueryString("call") ’電話
Sql= "Select * from 表名 where 1=1" ’1=1 避免所有查詢字段為空時出錯
if name <>"" then
Sql= Sql & "and 姓名 like ’%"& name &"%’"
end if
if sex <>"" then
Sql= Sql & "and 性別 = ’"& sex &"’" ’這個不是模糊查詢了
&n