你的寫法錯誤,不可以用SELECT * FROM dbo.adsale
WHERE buyer is null AND '%skeyword1%' like '%skeyword2%'
應該要每個下拉選單的值,各一個sql指令如下
<form method="POST" action="test2.asp">
<select size="1" name="titleno">
<option value="1">ID</option>
<option value="2">brand</option>
<option value="3">company </option>
</select><input type="text" name="title" size="20"><input type="submit" value="提交" name="B1"><input type="reset" value="重新設定" name="B2">
</form>
<!------test2.asp-------->
<%
if request("titleno")=1 then
sqlstr="SELECT * FROM adsale WHERE buyer is null AND " &_
"id like '%" & request("title") & "%' ORDER BY productid "
elseif request("titleno")=2 then
sqlstr="SELECT * FROM adsale WHERE buyer is null AND " &_
"brand like '%" & request("title") & "%' ORDER BY productid "
else
sqlstr="SELECT * FROM adsale WHERE buyer is null AND " &_
"company like '%" & request("title") & "%' ORDER BY productid "
end if
%>