请问除了临时表以外,有没有什么方法能够通过存储过程传递多给记录集给应用程序,如java

解决方案 »

  1.   

    我是问除了临时表以外,有没有什么方法能够通过存储过程传递多个记录集给应用程序。
    fcuandy,存储过程本来就可以返回记录集给应用程序,有方法吗;请赐教呀,8)
      

  2.   

    CREATE PROCEDURE [dbo].[selectmultiTable] ASselect * from tableA
    select * from tableB--这样存储过程就返回了两个数据集啊
      

  3.   

    在前台中定义DATASET,将这个数据集填充,
    DATASET.TABLE(0)  表示第一个表
    DATASET.TABLE(1)  表示第二个表
      

  4.   

    楼上讲的是在.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
    end3,调用.这里以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.executedo 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
    结果输出了
    d
    e
    f
    a
    b
    c
    说明已经读取了两个记录集.其实就是利用了Recordset对象的nextRecordset方法.无论是用 vb,asp,还是c++使用ado来操作具有多个记录集返回的存储过程(或批语句)时,都使用这个ado的方法