ASP选择语句的问题
请各位大虾告诉我:我是这样的,我有5个下啦框,每个下拉框中有最少3个选项,我要实现选一个框时就搜索出东西,选2个的组合框也能,选3个也能,选4个5个同样能,就是用ASP给我编出来,我大概用数学组合算了一下,是C51+C52+C53+C54+C55这么多种选法是吧?你们说这个程序怎么写,要写是写的出,但是也太烦琐了吧????有哪位大虾能告诉我怎么办???
<% dim a1,a2,a3,tAry,i,tRequest,sql,Str a1=request.form("a1") a2=request.form("a2") a3=request.form("a3") tRequest=a1&"|"&a2&"|"&a3 tAry=Split(tRequest,"|") For i=0 To Ubound(tAry) if tAry(i)<>"" Then sql=sql&" ID="&tAry(i)&" Or " End IF Next Str="select * from [user] where "&sql rs.open Str,conn,1,1 %> <form action="?" method="post"> <select name="a1"> <option value="1001">1001</option> <option value="1002">1002</option> <option value="1003">1003</option> </select> <select name="a2"> <option value="2001">2001</option> <option value="2002">2002</option> <option value="2003">2003</option> </select> <select name="a3"> <option value="3001">3001</option> <option value="3002">3002</option> <option value="3003">3003</option> </select> <input type="submit" value="提交" /> </form>
<% dim a1,a2,a3,tAry,i,sql,Str a1=request.form("a1") a2=request.form("a2") a3=request.form("a3") tAry=Array(a1,a2,a3) For i=0 To Ubound(tAry) if tAry(i)<>"" Then sql=sql&" ID="&tAry(i)&" Or " End IF Next Str="select * from [user] where "&sql rs.open Str,conn,1,1 %> <form action="?" method="post"> <select name="a1"> <option value="1001">1001</option> <option value="1002">1002</option> <option value="1003">1003</option> </select> <select name="a2"> <option value="2001">2001</option> <option value="2002">2002</option> <option value="2003">2003</option> </select> <select name="a3"> <option value="3001">3001</option> <option value="3002">3002</option> <option value="3003">3003</option> </select> <input type="submit" value="提交" /> </form>