sql="select * from table where col like '%"+text1.text+"%' and col like '%"+text2.text +"%'"
自己构造Where语句sql="select * from table where 1=1" if trim(text1.text)<>"" and trim(text2.text)<>"" then sql=sql & " and col1='" & text1.text & "' and col1='" & text2.text & "'" else ..................... end if
sql="select * from table where 1=1" if trim(text1.text)<>"" then sql=sql & " and col1='" & text1.text & "'" end if if trim(text2.text)<>"" then sql=sql & " and col2='" & text2.text & "'" end ifcn.execute sql
sql="select * from table where 1=1" if trim(text1.text)<>"" then sql=sql & " and col1='" & text1.text & "'" end if if trim(text2.text)<>"" then sql=sql & " and col2='" & text2.text & "'" end ifcn.execute sql
if trim(text1.text)<>"" and trim(text2.text)<>"" then
sql=sql & " and col1='" & text1.text & "' and col1='" & text2.text & "'"
else
.....................
end if
if trim(text1.text)<>"" then
sql=sql & " and col1='" & text1.text & "'"
end if
if trim(text2.text)<>"" then
sql=sql & " and col2='" & text2.text & "'"
end ifcn.execute sql
if trim(text1.text)<>"" then
sql=sql & " and col1='" & text1.text & "'"
end if
if trim(text2.text)<>"" then
sql=sql & " and col2='" & text2.text & "'"
end ifcn.execute sql