请问select from后的表名是变量该咋办
<form name="form2" method="post" action="结果.asp">
<label><span class="style1">请选择配件类别</span>
<select name="sel" size="1"class="STYLEME" id="sel">
<option value=" " selected>...请选择...</option>
<option value="dianchijian">电池</option>
<option value="erjijian">耳机</option>
<option value="cunchuka">存储卡</option>
<option value="chongdianqi">充电器</option>
</select>
</label>
</form>
<p class="style1"> </p>
<p class="style1"> </p>
<p class="style1">请输入手机配件名称
<input name="ts1" type="text" id="ts1" value="请输入配件名称">
<span class="STYLE5">(例:诺基亚电池)</span></p>
<p>
<input type="submit" name="Submit" value="确定">
<input type="reset" name="Submit2" value="取消">
</p>
</form>
<%
dim bb
dim aa
dim rs
dim sql
dim Conn
ConnStr="driver={sql server};server=127.0.0.1;database=diannao;uid=sa;pwd=111111"
set Conn=server.createobject("adodb.connection")
Conn.Open ConnStr
Set rs=Server.CreateObject("ADODB.Recordset")
aa=request.QueryString("sel")
response.Write(aa)
bb=request.QueryString("ts1")
sql="select * from "& aa & " where 配件名称= " & "'" & Request("ts1") & "'"
Set rs=conn.EXECUTE(sql)
rs.Open sql,Conn,1,3
if rs.EOF or rs.BOF then
Response.Write("<hr>数据库中暂无资料!")
Else
do while not rs.EOF or rs.BOF
但怎么实现不了!高手帮看看
[解决办法]
aa=request.QueryString("sel")
response.Write(aa)
bb=request.QueryString("ts1")
应该是:
aa=request.form("sel")
response.Write(aa)
bb=request.form("ts1")