在sql中查询出5条记录并将他们的id保存在一个变量里
比如我的数据库里有5条记录,我将他们查询出来,然后用一个变量保存所有的id像这样:sumid=1,2,3,4,5sumid是变量,后面的5个数字是id值,(asp网站)s...
比如我的数据库里有5条记录,我将他们查询出来,然后用一个变量保存所有的id像这样:sumid=1,2,3,4,5 sumid是变量,后面的5个数字是id值,(asp网站)set rs=server.CreateObject("adodb.recordset")
sql="select * from Lei "rs.open sql,conn,1,1
counts=rs.recordcount
for i=0 to counts
aaa(i)=rs("Lid")
next
response.Write aaa(i)
rs.close
set rs=nothing上面是我用数组做的,可是说aaa类型不匹配 展开
sql="select * from Lei "rs.open sql,conn,1,1
counts=rs.recordcount
for i=0 to counts
aaa(i)=rs("Lid")
next
response.Write aaa(i)
rs.close
set rs=nothing上面是我用数组做的,可是说aaa类型不匹配 展开
4个回答
2013-09-21
展开全部
for i=0 to counts
ii=ii+rs("Lid")+"|"
next
aaa=split(ii,"|")for j=1 to countsresponse.write aa(j)next
ii=ii+rs("Lid")+"|"
next
aaa=split(ii,"|")for j=1 to countsresponse.write aa(j)next
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-21
展开全部
dim aaa()set rs=server.CreateObject("adodb.recordset")
sql="select * from Lei "rs.open sql,conn,1,1
counts=rs.recordcount
for i=0 to counts
aaa(i)=rs("Lid")
response.Write aaa(i)next
rs.close
set rs=nothing
sql="select * from Lei "rs.open sql,conn,1,1
counts=rs.recordcount
for i=0 to counts
aaa(i)=rs("Lid")
response.Write aaa(i)next
rs.close
set rs=nothing
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-21
展开全部
Dim aaa()
set rs=server.CreateObject("adodb.recordset")
sql="select * from Lei "
rs.open sql,conn,1,1
counts=rs.recordcount
for i=0 to counts - 1
ReDim Preserve aaa(i)
aaa(i)=rs("Lid")
next
response.Write aaa(i)
rs.close
set rs=server.CreateObject("adodb.recordset")
sql="select * from Lei "
rs.open sql,conn,1,1
counts=rs.recordcount
for i=0 to counts - 1
ReDim Preserve aaa(i)
aaa(i)=rs("Lid")
next
response.Write aaa(i)
rs.close
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-21
展开全部
强制转换一下?aaa(i)=CINT(rs("Lid"))
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询