存储过程中的多个记录集 [英] Multiple Recordset from a Stored Procedure

查看:75
本文介绍了存储过程中的多个记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前端访问2000


我有一个存储过程,有2个参数BusinessUnitID和

年。

它返回多个记录集(确切地说是5个)。

我以为我可以使用Pass through查询,但只返回

第一个记录集。

我以为我可以使用ADO,但这似乎不起作用。我得到了一个

错误


当我从SQL改变SQL =procIPCReport时&安培;我和我, &

txtYear.Value



SQL =" select * FROM tblBudget


它打开并工作


我不能使用多次调用数据库的原因是最后4个

记录集是根据第一个记录集中的信息生成的。

程序可能需要5分钟才能生成结果,所以回到

服务器不是一个选项。


所以我的问题是我需要5个不同的记录集或1个记录集

包含多个记录集


我应该如何做到这一点?

Front-end Access 2000

I have a stored procedure that has 2 parameters BusinessUnitID and
Year.
It returns multiple record sets (5 to be exact).
I thought I could use a Pass through query but that only returns the
first record set.
I thought I could use ADO but that does not seem to work. I get an
Error

When I change the SQL from SQL = "procIPCReport " & i & ", " &
txtYear.Value
To
SQL = "select * FROM tblBudget

It opens and works

The reason I cannot use multiple calls to the database is the last 4
record sets are generated from the information in the first record set.
The procedure can take 5 minutes to generate results so going back to
the server is not an option.

So my question is I need either 5 different record sets or 1 record set
containing multiple record sets

How should I accomplish this?

推荐答案

你有一个SPROC返回五个记录集?


ADO似乎不起作用?


好​​的。我承认我没有看到一个SPROC返回五个

记录集,甚至两个。


其次ADO有效。如果出现错误,那是因为有人犯了

错误。


我猜你需要五种不同的记录集。我想通过获取ADO中的第一个记录集,从中选择

值来定义其他记录集并使用它们来获取另一个

四。


我开始用


Dim r(5)作为ADODB.Recordset


设置r(0)= CurrentProject.Execute(Whatever)


''从r(0)获取值;我假设这些是参数?

''使用值来表示


设置r(1)= CurrentProject.Execute(随时随地) ;);




You have a SPROC that returns five recordsets?

And ADO does not seem to work?

OK. I confess that I have not seen a SPROC that returns five
recordsets, or even two.

Secondly ADO works. When there''s an error it''s because someone made an
error.

I''m guessing you need five different recordsets. I''m thinking you get
them by getting the first recordset in ADO, selecting from it the
values needed to define the others and using them to get the other
four.

I''d start with

Dim r(5) as ADODB.Recordset

Set r(0) = CurrentProject.Execute("Whatever")

'' get value from r(0); I''m assuming these are parameters?
'' use the values to for

Set r(1) = CurrentProject.Execute("Whatever Wherever");

etc


我在SPROC中遇到问题我忘了设置NOCOUNT ON />

在ADO中但是当返回多个记录集时,你循环通过

记录这样的东西


SET Rst = Connection。执行(procMultipleRst)


doWhatever1 Rst


SET Rst = Rst.NextRecordset

doWhatever2 Rst


SET Rst = Rst.NextRecordset

doWhatever3 Rst





作品加载具有许多不同列表的表单时非常好只需要

一次调用数据库

注意:Rst 2到N是只读转发记录集


***通过开发人员指南发送 http://www.d evelopersdex.com ***
I had a problem in the SPROC I forgot to SET NOCOUNT ON

In ADO however when return multiple recordsets you loop through the
recordet something like this

SET Rst = Connection.Execute(procMultipleRst)

doWhatever1 Rst

SET Rst = Rst.NextRecordset
doWhatever2 Rst

SET Rst = Rst.NextRecordset
doWhatever3 Rst

etc

Works great when loading a form with many different list only requires
one call to the database
Note: Rst 2 to N are Readonly Forward Only recordsets


*** Sent via Developersdex http://www.developersdex.com ***


我明白了;听起来很棒。

I see; sounds like a great capability.


这篇关于存储过程中的多个记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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