"Operation is not allowed in this Context- Error 3219" 
Author Message
 "Operation is not allowed in this Context- Error 3219"

Hi.

With the following code, i have this error (Operation is not allowed in this
Context- Error 3219) on the rs.close statement, and i don't understand why:

    db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=toto.mdb"
    db.Open
    rs.open "SELECT * FROM Clients WHERE
Num_client=45",db,dbOpenStatic,adCmdText
    db.begintrans
    on error goto TheError
    rs.fields("Titi")="sdfgdg"  'An error occurs here, to test the rollback
statement
    rs.update
    on error goto 0
    db.committrans
TheEnd:
    db.close
    set db=nothing
    exit sub
TheError:
    db.rollback
    rs.close  'Error n3219 !!!
    set rs=nothing
    resume TheEnd

Any help would be appreciated !
Tahnks,

Magnum.



Fri, 06 May 2005 23:22:22 GMT  
 "Operation is not allowed in this Context- Error 3219"

Hi.

With the following code, i have this error (Operation is not allowed in this
Context- Error 3219) on the rs.close statement, and i don't understand why:

    db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=toto.mdb"
    db.Open
    rs.open "SELECT * FROM Clients WHERE
Num_client=45",db,dbOpenStatic,adCmdText
    db.begintrans
    on error goto TheError
    rs.fields("Titi")="sdfgdg"  'An error occurs here, to test the rollback
statement
    rs.update
    on error goto 0
    db.committrans
TheEnd:
    db.close
    set db=nothing
    exit sub
TheError:
    db.rollback
    rs.close  'Error n3219 !!!
    set rs=nothing
    resume TheEnd

What was the runtime error that caused you to go to TheError?

In addition, I don't see a reason for a rollback since you haven't performed an update at this
point.


Microsoft MVP (Visual Basic)



Sat, 07 May 2005 00:31:13 GMT  
 "Operation is not allowed in this Context- Error 3219"
Do you mean: if the update is not "validated", you don't need to make a
rollback, even if you work with a transaction ??

Second question: that doesn't explain why i can"t close the recordset. Is it
because the rollbacktrans statement close the recordset or what ?

Thanks.



Sat, 07 May 2005 05:47:43 GMT  
 "Operation is not allowed in this Context- Error 3219"

Do you mean: if the update is not "validated", you don't need to make a
rollback, even if you work with a transaction ??

Well in your example there is nothing to rollback because you haven't made an
update. I was only wondering why you were using an explicit transaction in this
instance because it wasn't necessary. You're only peforming a singe update.


Second question: that doesn't explain why i can"t close the recordset. Is it
because the rollbacktrans statement close the recordset or what ?

I looked at your code again. First, rollback should be rollbacktrans. I don't
know whether this is a typo but if not you need to change that. Rollbacktrans
should not close the Recordset. There is another problem here.

I asked what was causing the error that invokes the error handler because it
could be affecting your ability to close the Recordset.


Microsoft MVP (Visual Basic)



Sun, 08 May 2005 04:27:48 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. HELP: Delete adAffectGroup raises an error 3219 - not allowed in context

2. Closing a Recordset: Get error 3219 "Operation not allowed in this context"

3. "Operation is not allowed"

4. Operation is not allowed in this context

5. Operation not allowed in this context

6. operation not allowed in this context

7. Operation not allowed in this context

8. Operation not allowed in this context

9. Operation not allowed in this context

10. Operation not allowed in this context

11. Getting "Changed database context" error

12. Getting "Changed database context" error

 

 
Powered by phpBB® Forum Software