asp数据库循环输出
dimrs,sql,NavNamesetrs=server.createobject("adodb.recordset")sql="select*fromNavigati...
dim rs,sql,NavName
set rs = server.createobject("adodb.recordset")
sql="select * from Navigation where ViewFlag order by Sequence asc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write "暂无导航"
else
do while not rs.eof
NavName = rs("NavName")
rs.movenext
loop
end if
rs.close
set rs=nothing
if IsArray(NavName) then
response.write "是数组"
else
response.write "不是数组"
end if
怎么把NavName 定义成数组函数
在就是 怎么把NavName
拿出来循环输出 不在do while里 展开
set rs = server.createobject("adodb.recordset")
sql="select * from Navigation where ViewFlag order by Sequence asc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write "暂无导航"
else
do while not rs.eof
NavName = rs("NavName")
rs.movenext
loop
end if
rs.close
set rs=nothing
if IsArray(NavName) then
response.write "是数组"
else
response.write "不是数组"
end if
怎么把NavName 定义成数组函数
在就是 怎么把NavName
拿出来循环输出 不在do while里 展开
展开全部
改成如下这样应该就可以了
dim rs,sql
i_count = 0
set rs = server.createobject("adodb.recordset")
sql="select * from Navigation where ViewFlag order by Sequence asc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write "暂无导航"
else
do while not rs.eof
ReDim Preserve NavName(i_count) '动态定义数组个数
NavName(i_count) = rs("NavName") '赋值给数组
i_count = i_count + 1
rs.movenext
loop
end if
rs.close
set rs=nothing
if IsArray(NavName) then
response.write "是数组"
else
response.write "不是数组"
end if
dim rs,sql
i_count = 0
set rs = server.createobject("adodb.recordset")
sql="select * from Navigation where ViewFlag order by Sequence asc"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write "暂无导航"
else
do while not rs.eof
ReDim Preserve NavName(i_count) '动态定义数组个数
NavName(i_count) = rs("NavName") '赋值给数组
i_count = i_count + 1
rs.movenext
loop
end if
rs.close
set rs=nothing
if IsArray(NavName) then
response.write "是数组"
else
response.write "不是数组"
end if
展开全部
dim rs,sql,NavName()
dim cnt
set rs = server.createobject("adodb.recordset")
sql="select * from Navigation where ViewFlag order by Sequence asc"
rs.open sql,conn,3,3
if rs.bof and rs.eof then
response.write "暂无导航"
else
rs.movelast
cnt=rs.recordcount-1
redim navname(cnt)
rs.movefirst
for i =0 to cnt
navname=rs.fields("navname")
rs.movenext
if rs.eof the exit fro
next
rs.close
set rs=nothing
NavName 定义成数组函数:dim navname()
使用循环取出数据后,在程序有效范围内都可以使用总记录数cnt和for循环读取navname()中的数据
dim cnt
set rs = server.createobject("adodb.recordset")
sql="select * from Navigation where ViewFlag order by Sequence asc"
rs.open sql,conn,3,3
if rs.bof and rs.eof then
response.write "暂无导航"
else
rs.movelast
cnt=rs.recordcount-1
redim navname(cnt)
rs.movefirst
for i =0 to cnt
navname=rs.fields("navname")
rs.movenext
if rs.eof the exit fro
next
rs.close
set rs=nothing
NavName 定义成数组函数:dim navname()
使用循环取出数据后,在程序有效范围内都可以使用总记录数cnt和for循环读取navname()中的数据
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询