OleDbTransaction class is made just for that. You can create one by calling BeginTransaction on your OleDbConnection object then Commit or Rollback up to your scenario
using (var transaction = cn.BeginTransaction()) {
//Do Stuff here using the connection
transaction.Commit();
}
The transaction will be rolled back at dispose if no commit has been called.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…