g***@bcdiv.com
2006-12-12 06:14:50 UTC
Perhaps someone here can provide some ideas that will nudge me in the
right direction.
I have a stored procedure which is quite large. It outputs several
output parameters (15) and 13 recordsets. SET NO COUNT ON is used at
the beginning of the procedure to supress the (X records affected)
messages from SQL server. (SQL Server 2000)
I'm using ADO with Classic ASP and the command object with parameters.
My tests are on my local machine as I'm working on getting this
debugged before release (XP Pro)
What I've been struggling with is that the stored procedure returns the
first two recordsets okay. Each contains a single column of data and I
can iterate through the records within them without problem.
After the 2nd recordset however, I'm unable to retrieve the recordsets
via the following syntax:
'first and second recordset retrieved successfully - get the third
Set rs3 = rs.NextRecordset
rs3.GetRows
rs3Count = ubound(rs3, 2)
For i = 0 to rs3count
response.write rs3(0,i)
Next
This fails with a 'Current provider does not support returning multiple
recordsets from a single execution' error at the rs.NextRecordset line,
which appears to be due to the recordset being closed (checking
rs3.state before the offending line yields 0).
Running the stored procedure in Query Analyzer yields records for the
3rd recordset with the input parameters I'm using both in QA testing
and from rendering the ASP page.
I've yet to check that the output parameters are output with ADO (they
are in QA), as I cannot get past the closed recordsets.
I've tried removing all but 3 recordsets from the stored procedure,
checking first w/ QA to see that the data is returned (it is). The 3rd
recordset still fails.
Changing the order of the recordsets returned has similar results (ok
in QA, fails in the browser).
Trying to move past the closed recordset with the following also fails
(w/ error 'Current provider does not support returning multiple
recordsets from a single execution.' again apparently due to the closed
recordset.) It renders one "hi" message then fails.
Do Until rs.State = adStateOpen
response.write "hi<br />"
Set rs=rs.NextRecordset
Loop
I've attempted to find where my issue lies via google on ADO, ADO w/
stored procs, etc. but haven't come up with a reason why the recordsets
are being problematic.
I've got another stored procedure w/ both input and output parameters
as well as two recordsets which works via similar ADO code without a
problem.
I prefer to continue to use the command object and command parameters
if possible.
Any ideas on the issue that is causing a closed recordset to be
retrieved -- even with NO COUNT ON in the sproc?
Some things I'm wondering about --
Are there limitations on the data returned by a sproc? (So far though
this shouldn't be an issue based on QA results, but perhaps it is in
ADO? The data is primarily nvarchar and int fields and nothing very
long with about 3 date fields as well.)
What about limitations on the number of parameters or recordsets
returned?
Another thing I'm seeing is messages being generated in QA even with NO
COUNT ON when running the full sproc (which inserts into a temp table,
then manipulates data, before selecting its contents to return as a
recordset). This is without doing a SELECT (outside the sproc while
running it from QA) but only declaring the parameters, setting their
values and EXEC the sproc. In paring down the sproc I'm not seeing
these, but I'm wondering about the inserts into the tmp table --
perhaps these are the culprits?
Any assistance would be helpful! Thanks!!
Regards,
Bonnie
right direction.
I have a stored procedure which is quite large. It outputs several
output parameters (15) and 13 recordsets. SET NO COUNT ON is used at
the beginning of the procedure to supress the (X records affected)
messages from SQL server. (SQL Server 2000)
I'm using ADO with Classic ASP and the command object with parameters.
My tests are on my local machine as I'm working on getting this
debugged before release (XP Pro)
What I've been struggling with is that the stored procedure returns the
first two recordsets okay. Each contains a single column of data and I
can iterate through the records within them without problem.
After the 2nd recordset however, I'm unable to retrieve the recordsets
via the following syntax:
'first and second recordset retrieved successfully - get the third
Set rs3 = rs.NextRecordset
rs3.GetRows
rs3Count = ubound(rs3, 2)
For i = 0 to rs3count
response.write rs3(0,i)
Next
This fails with a 'Current provider does not support returning multiple
recordsets from a single execution' error at the rs.NextRecordset line,
which appears to be due to the recordset being closed (checking
rs3.state before the offending line yields 0).
Running the stored procedure in Query Analyzer yields records for the
3rd recordset with the input parameters I'm using both in QA testing
and from rendering the ASP page.
I've yet to check that the output parameters are output with ADO (they
are in QA), as I cannot get past the closed recordsets.
I've tried removing all but 3 recordsets from the stored procedure,
checking first w/ QA to see that the data is returned (it is). The 3rd
recordset still fails.
Changing the order of the recordsets returned has similar results (ok
in QA, fails in the browser).
Trying to move past the closed recordset with the following also fails
(w/ error 'Current provider does not support returning multiple
recordsets from a single execution.' again apparently due to the closed
recordset.) It renders one "hi" message then fails.
Do Until rs.State = adStateOpen
response.write "hi<br />"
Set rs=rs.NextRecordset
Loop
I've attempted to find where my issue lies via google on ADO, ADO w/
stored procs, etc. but haven't come up with a reason why the recordsets
are being problematic.
I've got another stored procedure w/ both input and output parameters
as well as two recordsets which works via similar ADO code without a
problem.
I prefer to continue to use the command object and command parameters
if possible.
Any ideas on the issue that is causing a closed recordset to be
retrieved -- even with NO COUNT ON in the sproc?
Some things I'm wondering about --
Are there limitations on the data returned by a sproc? (So far though
this shouldn't be an issue based on QA results, but perhaps it is in
ADO? The data is primarily nvarchar and int fields and nothing very
long with about 3 date fields as well.)
What about limitations on the number of parameters or recordsets
returned?
Another thing I'm seeing is messages being generated in QA even with NO
COUNT ON when running the full sproc (which inserts into a temp table,
then manipulates data, before selecting its contents to return as a
recordset). This is without doing a SELECT (outside the sproc while
running it from QA) but only declaring the parameters, setting their
values and EXEC the sproc. In paring down the sproc I'm not seeing
these, but I'm wondering about the inserts into the tmp table --
perhaps these are the culprits?
Any assistance would be helpful! Thanks!!
Regards,
Bonnie