楼上讲的是在.net下ado.net中.
我来说说ado里面怎么获得多个记录集.
1,创建测试表
CREATE TABLE t(id int identity(1,1),name varchar(10))
INSERT t SELECT 'a' UNION SELECT 'b' UNION SELECT 'c'
CREATE TABLE t1(id int identity(1,1),name varchar(10))
INSERT t SELECT 'd' UNION SELECT 'e' UNION SELECT 'f'
给这两结构相同的表插入了不同的记录,以便后面观查.
2,创建存储过程
CREATE proc test
as
begin
select * from t1
select * from t
end
3,调用.这里以asp为例子.
ConnStr = "Provider = Sqloledb;.....略"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
Set cmd = Server.CreateObject("Adodb.Command")
cmd.commandtype=4
cmd.activeconnection=conn
cmd.commandtext="test"
set rs=cmd.execute
do while not rs.eof
response.write rs(1) & "<br>"
rs.movenext
loop
set rs1=rs.nextrecordset
do while not rs1.eof
response.write rs1(1) & "<br>"
rs1.movenext
loop