Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

closing recordset generates exception

 
   Database Forums (Home) -> Visual Basic -> DAO RSS
Next:  Edit an existing pdf document  
Author Message
Hans van de Laar

External


Since: Aug 21, 2007
Posts: 1



(Msg. 1) Posted: Tue Aug 21, 2007 8:30 am
Post subject: closing recordset generates exception
Archived from groups: microsoft>public>vb>database>dao (more info?)

Hi,

Hi want to create a new record within a Try Catch block using the
following code

Function Process() As Boolean
Dim rsAttendance As New clsMSRecordSet
Dim rs As ADODB.Recordset
rs = rsAttendance.recordset
Try
rs.Open("AANWREG", Conn)
rs.AddNew()

rs.Fields("ADM#").Value = mfldAttAdmID
rs.Fields("CURSUS#").Value = mfldAttCourseID
rs.Fields("EVENEM#").Value = mfldAttEventID
rs.Fields("DEELNEM#").Value = mfldAttParticipentID
rs.Fields("EV_PLN#").Value = mfldAttPlanItemID

rs.Update()
Process = True
Catch ex As System.Runtime.InteropServices.COMException
'TO DO : logging exception to xml file
Finally
If (rs.State = ADODB.ObjectStateEnum.adStateOpen)
Then rs.Close() < - generating exception
rsAttendance = Nothing
End Try
End Function

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?
I'm using VB.NET and Visual Studio 2005

Regards,

Hans van de Laar

 >> Stay informed about: closing recordset generates exception 
Back to top
Login to vote
Ralph

External


Since: Jun 25, 2005
Posts: 348



(Msg. 2) Posted: Tue Aug 21, 2007 2:19 pm
Post subject: Re: closing recordset generates exception [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Hans van de Laar" <hansvandelaar.replace.at.micros.nl> wrote in message

> Hi,
>
> snipped
>
> I'm using VB.NET and Visual Studio 2005
>

Wrong group. This one is for Visual Basic (VB6 and lower) and DAO. Neither
of which are you using.

You can find a complete list of managed (dotNet) newsgroups here:
http://msdn.microsoft.com/subscriptions/managednewsgroups/list.aspx

 >> Stay informed about: closing recordset generates exception 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
DAO generates duplicate values for primary key fields and .. - While trying to add a new record to a table the DB engine reports : The changes you requested to the table were not succesfull because they would create duplicate values in the index, primary key or relation ship...Since there is only one Field named....

dao recordset error trapping - I have a dao recordset which I update with the following code: With rsOrderShip .Edit !CustCode = frmOrders.txtSTCustCode.Text !stcustname = frmOrders.txtSTCustName.Text !staddress1 = frmOrders.txtSTAddress1.Text ....

Error 3167 recordset is delete - Hello, ich habe in verschiedenen Newsgroups gesucht aber keine Lösung zu dem folgenden Problem gefunden. Zwei Personen arbeiten gemeinsam mit einem VB6-Programm an einer ACCESS 2000 Datenbank Der Zugriff von VB auf ACCESS erfolgt mit DAO 3.60. Eine de...

Deleting records from DAO recordset - [posted earlier in other group] Hi All, I'm using the following code to delete one or more records from a DAO recordset. The code is working but I was wondering if I need to Update the recordset with: rsDel.Update? Public Function DelRecs(Lstview As....

ADOR.RecordSet and Vista - I've inherited two sets of VB6 based com components from another developer. A set of client side activeX controls and a set of server side com controls. Basically, browser activated client side activex controls invokes server side control on Windows....
   Database Forums (Home) -> Visual Basic -> DAO All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]