Oct 18, 2003 #1 atferraz Technical User Aug 23, 2003 129 PT Helo how can I apply transaction, commits and rollbacks to a lot of inserts in one script? thanks anyone
Helo how can I apply transaction, commits and rollbacks to a lot of inserts in one script? thanks anyone
Oct 18, 2003 #2 SatishPutcha Programmer Mar 12, 2002 256 IN Hi If your connection object is con con.BeginTrans - Always needed to implement Transactions con.CommitTrans - Commits the transactions. All SQL statements after BeginTrans are not 'committed' till it finds CommitTrans. con.RollBackTrans - Aborts all SQL statements between BeginTrans and RollBackTrans. Hope this helped. Regards Satish Upvote 0 Downvote
Hi If your connection object is con con.BeginTrans - Always needed to implement Transactions con.CommitTrans - Commits the transactions. All SQL statements after BeginTrans are not 'committed' till it finds CommitTrans. con.RollBackTrans - Aborts all SQL statements between BeginTrans and RollBackTrans. Hope this helped. Regards Satish
Oct 19, 2003 Thread starter #3 atferraz Technical User Aug 23, 2003 129 PT Something like this Con.BeginTrans Con.Execute "Update ........." trans1 Con.Execute "Insert ........." trans2 Con.Execute "Delete ........." trans3 If Con.Errors.Count <> 0 Then Con.RollbackTrans Else Con.CommitTrans All or nothing, right? End if Upvote 0 Downvote
Something like this Con.BeginTrans Con.Execute "Update ........." trans1 Con.Execute "Insert ........." trans2 Con.Execute "Delete ........." trans3 If Con.Errors.Count <> 0 Then Con.RollbackTrans Else Con.CommitTrans All or nothing, right? End if
Oct 19, 2003 #4 onpnt Programmer Dec 11, 2001 7,778 US Con.Open ' open connection Con.Execute "Update ........." execute trans1 Con.Execute "Insert ........." execute trans2 Con.Execute "Delete ........." execute trans3 also, I do not believe vbscript has .Count for error trapping http://www.w3schools.com/ado/ado_ref_error.asp _____________________________________________________________________ http://www.onpntwebdesigns.com Upvote 0 Downvote
Con.Open ' open connection Con.Execute "Update ........." execute trans1 Con.Execute "Insert ........." execute trans2 Con.Execute "Delete ........." execute trans3 also, I do not believe vbscript has .Count for error trapping http://www.w3schools.com/ado/ado_ref_error.asp _____________________________________________________________________ http://www.onpntwebdesigns.com
Oct 19, 2003 #5 SatishPutcha Programmer Mar 12, 2002 256 IN atferraz: Yes, you got it right. From what I remember, the queries are not 'committed' till you call CommitTrans. For Error trapping use Err object with On Error Resume Next. Regards Satish Upvote 0 Downvote
atferraz: Yes, you got it right. From what I remember, the queries are not 'committed' till you call CommitTrans. For Error trapping use Err object with On Error Resume Next. Regards Satish