asp 答案正确送50分~~急需啊

来源:百度知道 编辑:UC知道 时间:2024/05/12 04:48:47
bj=session("bj")
aryReturn= Split(bj,",")
For i = LBound(aryReturn) To UBound(aryReturn)
bj=Right(aryReturn(i),Len(aryReturn(i)))
strSQL="Select * From student where s_c_id="&session("ys")&" and b_id="&bj&" Order By s_id Desc"
Next
rs.open strSQL,conn,1,1

session("bj")是一个数组,1,2,3这种格式的,通过for循环bj能分别得到这三个数,我要把这个作为一个条件查询,上面的代码只能循环得到三条strSQL语句,但是rs.open strSQL,conn,1,1 查询的时候就只根据其中一条来查询了。有没有办法只让b_id="&bj&"这个条件来循环呢~

楼主的意思太不明白了

你这样,它只能查询最后一条了.

bj=session("bj")
aryReturn= Split(bj,",")
For i = LBound(aryReturn) To UBound(aryReturn)
bj=Right(aryReturn(i),Len(aryReturn(i)))
strSQL="Select * From student where s_c_id="&session("ys")&" and b_id="&bj&" Order By s_id Desc"
rs.open strSQL,conn,1,1
....
rs.close
Next