ASP 接受多值的问题

来源:百度知道 编辑:UC知道 时间:2024/05/14 03:33:13
我在ASP中需要读出 同一个值,但起ID不同。
而这个ID必须以此为条件,查询另一个表的数据。
此出应该如何查询,并如何传递?
我读出ID和接受的代码是:
set rs=server.CreateObject("adodb.recordset")
id=request("id")

'测试
rs.open "select * from product_class where up_class="&request("id")&" order by id asc",conn,3,3

if not rs.eof then
for i=1 to 100

id1=rs("id")

rs.movenext
if rs.eof or rs.bof then exit for
next
else
response.write "no record!"
end if
rs.close

'结束
rs.open "select * from product where class="&id1&"",conn,3,3
请教高手应如何正确写这段代码!

set rs1=conn.execute("select * from product where class=(select id from product_class where up_class="&request("id")&" order by id asc)")

同意楼上的,不过如果这样写的话,可以简化很多代码!

set rs=server.CreateObject("adodb.recordset")
id=request("id")
rs.open "select * from product_class where up_class="&request("id")&" order by id asc",conn,3,3
while not rs.eof
id1=rs("id")
set rs1=conn.execute("select * from product where class="&id1)
while not rs1.eof
response.write("在此写入要查询的数据")
wend
rs1.colose
wend
rs.close
set rs=nothing