我的存储过程中有如下3个语句:
select * from tableA
select * from tableB
select * from tableC如果我想得到tableB的数据付到我的窗体中,怎么取?

解决方案 »

  1.   

    Public Function Fy() As ADODB.Recordset    Dim rs2 As ADODB.Recordset
        Dim cmd As ADODB.Command
        Set rs2 = New ADODB.Recordset    Set cmd = New ADODB.Command
      
        cmd.ActiveConnection = 连接字符串
        cmd.CommandText = "存储过程名"    cmd.CommandType = adCmdStoredProc
        Set rs2 = cmd.Execute    Set Fy = rs2.NextRecordset'这句是获得第2个记录集
        Set cmd = Nothing    Set rs2 = NothingEnd Function
      

  2.   

    谢谢先!CREATE PROCEDURE Injection机械图番别 @indate datetime AS
    declare cur_tmpTable cursor local for select name from sysobjects where name='tmpxmg'
    open cur_tmpTable
    fetch  from cur_tmpTable
    while @@FETCH_STATUS=0 
    begin
    drop table tmpxmg
    fetch  from cur_tmpTable
    end
    close cur_tmpTable
    DEALLOCATE cur_tmpTableselect * into tmpXmg from zsp指示票制作分卡
    alter table tmpxmg alter column 批号 nvarchar(50) select distinct 图号,机械 from(
    select 图号,'' as 机械 from tmpxmg a where not exists (select * from 生产实绩传票 b where a.图号=b.图番 and a.批号=b.枝番 and a.分卡号=b.卡番) and 纳期>@indate
    ) a where 图号 not in (select 图号 from injection机械种别入力管理)
    GO我上面的存储过程,其实我只想返回最后面的结果集,而事实上前面的2个fetch分别又产生了一个结果集,有办法将前面的2个结果集干掉吗?