DoraMeMe
asked on
Rollback using ADO.Recordset!
Hi,
I use ADO to add/update/delete record to my Oracle DB.
In using a recrodset's method --> AddNew, Update.
Do I need to do a rollback if the AddNew, Update fails?
If yes, how can I do this?
I found there exists a rollback method at the conneciton object, but not at recordset object.
My table at oralce db contains a field which is of type BLOB.
I only know how to use the recordset object to add record to this table which will add a binary file to the database.
In my case, how can I do a rollback if the operation fails?
Thanks for your advice!
I use ADO to add/update/delete record to my Oracle DB.
In using a recrodset's method --> AddNew, Update.
Do I need to do a rollback if the AddNew, Update fails?
If yes, how can I do this?
I found there exists a rollback method at the conneciton object, but not at recordset object.
My table at oralce db contains a field which is of type BLOB.
I only know how to use the recordset object to add record to this table which will add a binary file to the database.
In my case, how can I do a rollback if the operation fails?
Thanks for your advice!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
corvanderlinden is correct for the single action (insert/update) you have internal transactions.
Unless you are proposing that you are updating mutliple tables with in one transactions
sub thisSub()
On error goto ErrHandl
cn.BeginTrans
cn.execute(sqlstuff)
cn.execute(sqlStuff2)
cn.commit
exit sub sub
ErrHandl:
cn.Rollback
err.raise.....
end sub
sub thisSub()
On error goto ErrHandl
cn.BeginTrans
cn.execute(sqlstuff)
cn.execute(sqlStuff2)
cn.commit
exit sub sub
ErrHandl:
cn.Rollback
err.raise.....
end sub
Hi DoraMeMe,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Split points between: TimCottee and corvanderlinden
DoraMeMe, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:
Split points between: TimCottee and corvanderlinden
DoraMeMe, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you. DO NOT accept this comment as an answer.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
per recommendation
SpideyMod
Community Support Moderator @Experts Exchange
TimCottee points for you at:
https://www.experts-exchange.com/questions/20463697/Points-for-TimCottee-re-various.html
SpideyMod
Community Support Moderator @Experts Exchange
TimCottee points for you at:
https://www.experts-exchange.com/questions/20463697/Points-for-TimCottee-re-various.html
- Pseudo-code :
Connection.BeginTrans
Recordset.ProcessData
If Connection.Errors.Count > 0 Then 'Rollback
Connection.Rollback
Else
Connection.CommitTransacti
End If
Everything contained in the Recordset.ProcessData section is contained within the transaction and all actions will be either committed or rolled back at the end of the process.
As for the necessity of doing a rollback etc for an addnew/update, it all depends on your database, the criticality of the data etc.