Problems with ADODB.Recordset objects and with the ADODC data control (recordset property) [Specificially when assigning a dynamically created RS to the RS property of the ADO data control]

Problems with ADODB.Recordset objects and with the ADODC data control (recordset property) [Specificially when assigning a dynamically created RS to the RS property of the ADO data control]

Post by Rick Rothstei » Fri, 05 Feb 1999 04:00:00



Nothing to do with your question, but you might want to check out your
system date -- you seem to be two weeks ahead of the rest of us.


>I have hit a problem regarding the ADODC control and the ADODB.Recordset
>object in the project that I am working on currently.  I am hoping perhaps
>someone has seen something similar and might be able to point me in the
>proper direction.  I do not know if I am causing the problem or if it is a
>bug, something else I would love to know before I devout to much time.

>I am having two problems, one with a ADODB.Recordset Object, the other with
>the ADODC data control.  Elsewhere in the project, both of these objects
>seem to work properly, only causing these problems when they are combined.
>I have a Class object which has a private module level variable declared
as:

>Private mRecordset as ADODB.Recordset

>This recordset (or a reference to it) is passed out of the class object via
>a get/set property pair.  This recordset is dynamically created by
appending
>fields to a new RS, and does not have a connection object or a datasource
in
>the traditional sense.

>I set (it is passed through the get property) this recordset object to the
>.Recordset property of an ADODC Data Control.  Everything up to this point
>seems (fingers crossed, i've heard alot of ADO complaints) to work
properly.
>The problem that I have is that when I attempt to Close this recordset
>object I get a runtime error indicating that the specified method (which
was
>.Close) is not allowed within 'this' context (although I'm not certain to
>what context this refers):

>Runtime error '3219'
>The operation requested by the application is not allowed in this context.

>I have verified the 'state' of the recordset object, as well as tried a
>number of different configurations regarding where the .Close method call
>occurs (from mRecordset in the class, or in the ADODC data control for
>example), as well as releasing the class which mRecordset resides in.  The
>mRecordset object has all default ADODB.Recordset properties except these
>three which are set programmatically:

>.CursorType = adOpenDynamic
>.LockType = adLockOptimistic
>.CursorLocation = adUseClient

>I also have an associated problem (all related because they occur when I'm
>trying to unload everything) in thar when I attempt to set the mRecordset
>object (the class variable) to Nothing or to set the .Recordset property of
>the ADODC to nothing I get a strange automation error (I did try this w/ a
>connection object, and this error doesn't appear in it's Errors collection)
>that vaguely states that an error occured in the recordset object.  To make
>the matter all the more confusing, when I am stepping through the code,
this
>error occurs at the first attempt of:

>    set mRecordset = nothing

>and reports:

>    RunTime error '-2147417848 (80010108)' Method 'Recordset' of object
>'IAdodc' failed

>This only seems to occur when a recordset has been passed to the .Recordset
>property of the ADODC control.  Both of these things seem to point a finger
>at the ADODC because I use many recordsets, with and without actual
>connections, and have seen none of these problems under similar conditions
>with the exception of the usage of the ADODC control.

>If anyone has experienced these problems or similar, any help in resolving
>this issue would be GREATLY appreciated.  If possible, as email response
>would be best because I don't get to check the news groups as often as I
>would like, but I will try to keep up for the next bit of time at least....

>Thanks in advance,
>Joshua Toole

 
 
 

Problems with ADODB.Recordset objects and with the ADODC data control (recordset property) [Specificially when assigning a dynamically created RS to the RS property of the ADO data control]

Post by Norm Fenlaso » Sat, 06 Feb 1999 04:00:00


Don't have access to Joshua's original message, but here is a try.

I think that the data control is not releasing its reference to the recordset
object. As long as the recordset "reference counter" is not zero, it will not
close, terminate or be set to nothing. Try setting the ADODC's recordset
property to nothing, then the ADODB recordset to nothing (or close it). But
releasing reference by the data control must happen first. This is just a guess,
since I have not seen this problem.

Norm Fenlason
ENSCO Inc.


> Nothing to do with your question, but you might want to check out your
> system date -- you seem to be two weeks ahead of the rest of us.


> >I have hit a problem regarding the ADODC control and the ADODB.Recordset
> >object in the project that I am working on currently.  I am hoping perhaps
> >someone has seen something similar and might be able to point me in the
> >proper direction.  I do not know if I am causing the problem or if it is a
> >bug, something else I would love to know before I devout to much time.

> >I am having two problems, one with a ADODB.Recordset Object, the other with
> >the ADODC data control.  Elsewhere in the project, both of these objects
> >seem to work properly, only causing these problems when they are combined.
> >I have a Class object which has a private module level variable declared
> as:

> >Private mRecordset as ADODB.Recordset

> >This recordset (or a reference to it) is passed out of the class object via
> >a get/set property pair.  This recordset is dynamically created by
> appending
> >fields to a new RS, and does not have a connection object or a datasource
> in
> >the traditional sense.

> >I set (it is passed through the get property) this recordset object to the
> >.Recordset property of an ADODC Data Control.  Everything up to this point
> >seems (fingers crossed, i've heard alot of ADO complaints) to work
> properly.
> >The problem that I have is that when I attempt to Close this recordset
> >object I get a runtime error indicating that the specified method (which
> was
> >.Close) is not allowed within 'this' context (although I'm not certain to
> >what context this refers):

> >Runtime error '3219'
> >The operation requested by the application is not allowed in this context.

> >I have verified the 'state' of the recordset object, as well as tried a
> >number of different configurations regarding where the .Close method call
> >occurs (from mRecordset in the class, or in the ADODC data control for
> >example), as well as releasing the class which mRecordset resides in.  The
> >mRecordset object has all default ADODB.Recordset properties except these
> >three which are set programmatically:

> >.CursorType = adOpenDynamic
> >.LockType = adLockOptimistic
> >.CursorLocation = adUseClient

> >I also have an associated problem (all related because they occur when I'm
> >trying to unload everything) in thar when I attempt to set the mRecordset
> >object (the class variable) to Nothing or to set the .Recordset property of
> >the ADODC to nothing I get a strange automation error (I did try this w/ a
> >connection object, and this error doesn't appear in it's Errors collection)
> >that vaguely states that an error occured in the recordset object.  To make
> >the matter all the more confusing, when I am stepping through the code,
> this
> >error occurs at the first attempt of:

> >    set mRecordset = nothing

> >and reports:

> >    RunTime error '-2147417848 (80010108)' Method 'Recordset' of object
> >'IAdodc' failed

> >This only seems to occur when a recordset has been passed to the .Recordset
> >property of the ADODC control.  Both of these things seem to point a finger
> >at the ADODC because I use many recordsets, with and without actual
> >connections, and have seen none of these problems under similar conditions
> >with the exception of the usage of the ADODC control.

> >If anyone has experienced these problems or similar, any help in resolving
> >this issue would be GREATLY appreciated.  If possible, as email response
> >would be best because I don't get to check the news groups as often as I
> >would like, but I will try to keep up for the next bit of time at least....

> >Thanks in advance,
> >Joshua Toole


 
 
 

Problems with ADODB.Recordset objects and with the ADODC data control (recordset property) [Specificially when assigning a dynamically created RS to the RS property of the ADO data control]

Post by Joshua Tool » Sat, 06 Feb 1999 04:00:00


Thanks for the help (to everyone who replied).  We (because of time
constraints) contacted Microsoft on this one, and apparently this is some
variation on a known bug w/ ADODC and ADODB (MS's case is specifically when
one assigns a hierarchical recordset to the recordset property of an ADODC).
While our case is a bit different in that the problem only occurs when
closing out this RS, the error message is the same.  I also think that an
cryptic Automation error from inside a component such as this is indicative
of an internal error, not a programmatic one.

For anyone interested, the bug which this is similar to is Q192805 in the
knowledge base...

Unfortunately Microsoft doesn't have a resolution to the problem, and now
I'm left trying to find a way around it...

Again, Thanks for the assistance,
Joshua Toole


>Don't have access to Joshua's original message, but here is a try.

>I think that the data control is not releasing its reference to the
recordset
>object. As long as the recordset "reference counter" is not zero, it will
not
>close, terminate or be set to nothing. Try setting the ADODC's recordset
>property to nothing, then the ADODB recordset to nothing (or close it). But
>releasing reference by the data control must happen first. This is just a
guess,
>since I have not seen this problem.

>Norm Fenlason
>ENSCO Inc.

<snipped>