Re: multi recordset error?
- From: "Daniel Crichton" <msnews@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 16:28:39 +0100
jerry.xuddd wrote on Thu, 30 Jun 2005 06:02:04 -0700:
> I have a stored procedure to return two tables. (so two recordsets)
>
> The thing is that when no records in the first table, I will get
> recordCount -1 for both two returned tables.
> When I added some records in the the first table and then the code works
> fine.
>
> So what is the problem? Is there some configuration values I should set? I
> already had SET NOCOUNT ON in the stored procedure.
>
> I use vb and ado 2.5.
>
> The simple code I use is:
> Set objRecordset = New ADODB.Recordset
>
> objRecordset.CursorType = adOpenStatic
> objRecordset.Open "SP_SYN_AD", objConn, adOpenStatic, adLockReadOnly,
> adCmdStoredProc
>
> read data
>
> move to next recordset
>
> ....
>
Have you tried setting the CursorLocation to adUseClient? A server side
cursor will often result in a -1 for the recordcount (which is why I always
check for BOF and EOF rather than rely on recordcount).
Also there's no need for you to specify the cursortype property and then
repeat it in the open statement (however this won't impact anything, it's
just makes for slightly more manageable code to only use it in one place or
else you might have issues in the future should you decide to change the
cursortype value and forget to change it in both places).
Dan
.
- Follow-Ups:
- Re: multi recordset error?
- From: jerry.xuddd
- Re: multi recordset error?
- References:
- multi recordset error?
- From: jerry.xuddd
- multi recordset error?
- Prev by Date: should I close connection?
- Next by Date: Re: Parameter to a Stored Procedure
- Previous by thread: multi recordset error?
- Next by thread: Re: multi recordset error?
- Index(es):
Relevant Pages
|
|