二维数组排序

kly 2002-11-14 04:32:26
我想把两个数据库中的字段读出来,写进二维数组,然后再根据某个字段排序:
例如:数据库1:有字段1,字段2,数据库2有字段3,字段4
二维数组:

字段1 字段2
字段3 字段4

其中,这些字段里面都有很多记录。。。再打乱按列排序

不知道我说清楚没有?
...全文
60 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
cshadow 2002-11-14
  • 打赏
  • 举报
回复
给你看个例子:
<%
set rs1=server.createobject("adodb.recordset")
rs1.open "select * from myjiejing where MyHuoZai_ID='" & cstr(request("id")) & "' and thechange=0 and ",conn,1,1

set rs2=server.createobject("adodb.recordset")
rs2.open "select * from mycucedan where MyHuoZai_ID='" & cstr(request("id")) & "' and thechange=0",conn,1,1
set rs3=server.createobject("adodb.recordset")
m=rs1.recordcount+rs2.recordcount
e=rs1.recordcount
u=rs2.recordcount

redim scroe(m,5)
for i=1 to e
scroe(i,1)=rs1("id")
scroe(i,2)=rs1("thetime")
scroe(i,3)="接警"
scroe(i,4)="<a href='jjshow.asp?id="&scroe(i,1)&"&type=j'><font color='#FF0000'>电话号码:"&rs1("telno")&"...</a>"
scroe(i,5)="<a href='jjshow2.asp?id="&scroe(i,1)&"&type=j'><u>查看</u></a>"
rs1.movenext
next


for i=e+1 to m
scroe(i,1)=rs2("id")
scroe(i,2)=rs2("gotime")
scroe(i,3)="出车单"
scroe(i,4)="<a href='ccshow.asp?id="&scroe(i,1)&"&type=c'><font color='#FF0000'>出动车辆数量:"&rs2("HowCar")&"...</a>"
scroe(i,5)="<a href='ccshow2.asp?id="&scroe(i,1)&"&type=c'><u>查看</u></a>"
rs2.movenext
next


'for i=1 to m
'for j=1 to 3
' response.write scroe(i,j)&"  "
' next
'Response.Write "<br>"
'next
'response.end
for i=1 to m-1
for j=i+1 to m
if scroe(i,2)>scroe(j,2) then
for k=1 to 5
x=scroe(j,k)
scroe(j,k)=scroe(i,k)
scroe(i,k)=x
next
end if
next
next
%>

28,391

社区成员

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

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