#12005/6/15 13:16:42
我数据库有“规格型号1”,“规格型号,2”,“规格型号3”三个字段,在查询页面的下拉菜单中如设置“规格型号1”,“规格型号,2”,“规格型号3”将会很难看,因此我想用“规格型号”中来对应这三个字段,即输入查询关键字后,再点击下拉菜单中的规格型号就去三个字段查找关键字对应的记录,请问这个如何做?
<%
'设置查询条件
if Request("cif")<>"" and Request("ccif")<>"" and Request("qvalue")<>"" then
session("MMColParam") = ""
if (Request("qvalue") <> "") then session("MMColParam") = Request("qvalue")
session("varcif")= ""
if (Request("cif") <> "") then session("varcif") = Request("cif")
session("varccif") = "ALL"
if (Request("ccif") <> "") then session("varccif") = Request("ccif")
else
if session("varccif")="" then
session("varccif")="ALL"
end if
end if
%>
<%
set rs = Server.CreateObject("ADODB.Recordset")
'设置查询字符串
if session("varccif") = "LIKE" then
sql ="SELECT * FROM wl WHERE "&_
Replace(session("varcif"), "'", "''") & " " & Replace(session("varccif"), "'", "''") &_
" '%" & Replace(session("MMColParam"), "'", "''") & "%'"
else
if session("varccif") = "ALL" then
sql = "SELECT * FROM wl"
else
sql ="SELECT * FROM wl WHERE "&_
Replace(session("varcif"), "'", "''") & " " & Replace(session("varccif"), "'", "''") &_
" '" + Replace(session("MMColParam"), "'", "''") & "'"
end if
end if
rs.open sql,conn,1,1
<option value="wlmodel">规格型号</option>
<option value="wlfactory">生产厂家</option>