asp查询结果,将每条数据的两个字段放到二唯数组,后边在遍例取出

hcqhappy 2006-04-01 01:54:18
sql="select top 10 id,biaoti from xinwen order by fbsj DESC"

查询结果将 id biaoti 对应的数据 放到二唯数组 如果查询条数不够 放"" 进去

后边在 打出 每条记录对应的id biaoti

请给出较完整的程序 谢谢了
...全文
136 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
devilzone 2006-04-01
  • 打赏
  • 举报
回复

sql="select top 10 id,biaoti from xinwen order by fbsj DESC"
Set Rs = Server.CreateObject("Adodb.RecordSet")
Rs.Open Sql,Conn,1,1
Dim temArray(1,9)
for i = 0 to 9
If Not Rs.Eof Then
temArray(0,i) = Rs(0)
temArray(1,i) = Rs(1)
Rs.MoveNext
Else
temArray(0,i) = ""
temArray(1,i) = ""
End If
Next
for i = 0 to 9
Response.Write "id:"&temArray(0,i)&"; biaoti:"&temArray(1,i)&"<br>"
Next
hbjmdx008 2006-04-01
  • 打赏
  • 举报
回复

dim total(10,2)
do while not rs.eof
total(i,1)=rs("id")
total(i,2)=rs("biaoti")
rs.movenext
loop
KimSoft 2006-04-01
  • 打赏
  • 举报
回复
recordset 对象有个自带的getrows方法,可以直接得到你想要的结果

详细请参考:
http://www.webjx.com/htmldata/2005-08-21/1124584431.html

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧