Re: Working with the ADO .NextRecordset method

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Rene (presse_spammerssuck_at_hotmail.com)
Date: 03/10/04


Date: Wed, 10 Mar 2004 09:26:40 -0500

Hello David,

Many thanks for your post - you put me on an interesting track!

I immediately gave your suggestion a try, and here is what I found.
I did have to set a reference to ADO 2.7 - I had been using ADO 2.5 till
now.

Setting the 'Ouput Stream' property of the command object to a stream works
as expected.
Note: don't use the Set syntax:
    mCommand.Properties("Output Stream") = mStm

Executing the command with the adExecuteStream option also worked,
I did change the stored proc and added the 'FOR XML Auto' clause to each
Select for the stream operation to run.
    mCommand.Execute , , adExecuteStream

Remember, the server side stored procedure is set up to return multiple
recordsets.
So when I attempted to fetch what I expected would be the 'first recordset'
from my stored procedure I got the following message:

    Set mRst = New ADODB.Recordset
    mRst.Open mStm, , adOpenForwardOnly, adLockReadOnly

    Run-Time error '-1072896683 (c00ce555)'
    Only one top level element is allowed in an XML document

This leads me to believe that in the .Execute operation streams ALL the
recordsets in one execution; moreover it would appear they're all stored as
'top level documents' - whatever that means! The stream object would
contain multiple recordsets.

I took a look at the contents of the Stream object using its .ReadText
method. From what I can gather, indeed the result of two selects were
there - as was expected from the stored procedure.
One peculiar thing (I'm not very knowledgable in XML specifics):
    the first resultset seemed OK,
    but the second one had the view name prefixing each row ???

Anyways, in response to your question/suggestion, I'm not so sure anymore
that Command execution streaming its results directly to a Stream object is
meant to retrieving 'multiple' result sets through which one can iterate.

Comments?

Thanx a million for the pointer!

René
Montreal

> I think that the next interesting idea is to see if you can
> eliminate the initial stream-to-recordset conversion: ie,
> if you open a stream object against the connection (instead
> of a recordset), can you iterate through the multiple result
> sets?
>
> Try this: set an output stream as a command property:
> set mCommand.Properties("Output Stream") = mstm (????)
>
> specify adExecuteStream as an option of the Execute command:
> mCommand.Execute(,,adExecuteStream) (????)
>
> what result do you get ?????
>
> (david)
>



Relevant Pages

  • Re: Working with the ADO .NextRecordset method
    ... Setting the 'Ouput Stream' property of the command object to a stream works ... the server side stored procedure is set up to return multiple ... This leads me to believe that in the .Execute operation streams ALL the ... recordsets in one execution; moreover it would appear they're all stored as ...
    (microsoft.public.vb.database.ado)
  • DAAB - run SP
    ... I am learning how to use DAAB. ... I need to execute a stored procedure and return the result as a stream. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: ORA-03123
    ... I want to execute the following sql in a data source in Cognos Decision ... When I execute it I am getting the following errors in Decision stream ... A general exception has occurred during operation ...
    (comp.databases.oracle.misc)
  • Re: Execute Stream?
    ... > I join the two files together with Stream and I want to execute ... > the result in manner to get preview before saving it to disk.. ... execute it, then, if it's OK, save the stream to the name you want to ...
    (alt.comp.lang.borland-delphi)
  • Re: MPEG-2 transport stream -> MPEG-4 H.264 from the command line
    ... If you want to use batch processing, please open the batch list using ... batch list is open every conversion ... The source stream used is of course, the one shown in the player. ... To execute the task ...
    (comp.sys.mac.system)