Re: Closing recordset generates exception
- From: "Hans van de Laar" <hansvandelaar.replace.at.micros.nl>
- Date: Wed, 22 Aug 2007 05:35:49 -0700
Hi Stephen,
Thanks for helping me.
May be I had to supply the source code of the recordset class I'm using
which sets the Cursorlocation, Cursortype and locktype properties.
Public Class clsMSRecordSet
Public Sub New()
MyBase.New()
With _rs
.CursorLocation = ADODB.CursorLocationEnum.adUseServer
.CursorType = ADODB.CursorTypeEnum.adOpenKeyset
.LockType = ADODB.LockTypeEnum.adLockOptimistic
End With
End Sub
Private _rs As New ADODB.Recordset
Public ReadOnly Property recordset() As ADODB.Recordset
Get
Return _rs
End Get
End Property
End Class
I'm rather new to .NET so if you can give me some good advise I really
appreciate this.
Thanks,
Hans
Stephen Howe wrote:
.
When the update fails I get a descriptive message but I an other
error "operation not allowed in this context" is thrown up when the
rs.Close() is issued. Any idea why is this happening?
Your RecordSet Open is deficient.
The RecordSet will be being open in ReadOnly mode as that is the
default LockType. Naturally that will prevent an Update().
For this:
rs.Open("AANWREG", Conn)
is ADO supposed to guess that "AANWREG" is a table?
Why arent you specifying CursorLocation, LockType, CursorType and
additional arguments telling ADO what "AANWREG" is? Open() is the
most important call of a Recordset, it affects various properties,
behaviour of methods, it is crazy to allow default arguments. It also
affects performance.
Cheers
Stephen Howe
- Follow-Ups:
- Re: Closing recordset generates exception
- From: Stephen Howe
- Re: Closing recordset generates exception
- From: Stephen Howe
- Re: Closing recordset generates exception
- References:
- Closing recordset generates exception
- From: Hans van de Laar
- Re: Closing recordset generates exception
- From: Stephen Howe
- Closing recordset generates exception
- Prev by Date: Re: Closing recordset generates exception
- Next by Date: Re: Closing recordset generates exception
- Previous by thread: Re: Closing recordset generates exception
- Next by thread: Re: Closing recordset generates exception
- Index(es):
Relevant Pages
|