如何在两个记录的数据相结合,在传统的ASP 1记录 [英] how to combine Two recordset data to one recordset in classic asp

查看:702
本文介绍了如何在两个记录的数据相结合,在传统的ASP 1记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我呼吁两个存储过程使用不同的数据库连接。我以前在页面两个单独的记录集,但我需要在两者一起排序还需要设置一个记录的完美组合。

I am calling two "stored procedures" using different database connection. I used two separate record sets in page but I required combining both in one record set along with sorting also required.

例如:两个记录集RS1,的Rs2

Ex: two records set Rs1, Rs2

Emp_ code等级名称

Emp_code Name Grade

001 BCD A

001 Bcd A

004美国广播公司ç

004 Abc C

Emp_ code等级名称

Emp_code Name Grade

002 XYZ A

002 Xyz A

005 ZXY乙

Emp_ code等级名称

Emp_code Name Grade

001 BCD A

001 Bcd A

002 XYZ A

002 Xyz A

004美国广播公司ç

004 Abc C

005 ZXY乙

点击此链接它正确显示

http://i.stack.imgur.com/aNLOn.jpg

推荐答案

创建第三个记录和RS1和RS2的行粘贴到新的:

Create a third recordset and paste the rows from RS1 and Rs2 into that new one:

set newRs = server.createobject("adodb.recordset")

for each fld in Rs1.fields
    newRs.fields.append fld
next

newRs.open

' fill data from Rs1
do while not rs1.eof
    for each fld in Rs1.Fields
        newRs(fld.name).value = fld.value
    next
    newRs.update

    rs1.movenext
loop

' fill data from Rs2
do while not rs2.eof
    for each fld in Rs2.Fields
        newRs(fld.name).value = fld.value
    next
    newRs.update

    rs2.movenext
loop

newRs.Sort = "emp_code asc, name asc, grade asc"

这篇关于如何在两个记录的数据相结合,在传统的ASP 1记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆