大致就同上面各位所说,我一般用SESSION来组合。
If Trim(str3) <> "" Then
If Session("findwhere") <> "where" Then
Session("findwhere") = Session("findwhere") & d31 & " shdh like '%" & str3 & "%' "
Else
Session("findwhere") = Session("findwhere") & " shdh like '%" & str3 & "%' "
End If
End If
If txtName.Text<>"" then
strSql=strSql & " And [Name] = '" & txtName.Text & "' "
End If
If List1.SelectedIndex<>0 then
strSql=strSql & " And [DeptID] = '" & List1.Items(List1.SelectedIndex).Value & "' "
End If