建立在C#中的MS Access交易 [英] create a transaction for MS Access in c#
本文介绍了建立在C#中的MS Access交易的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在我的C#应用程序的一些代码中使用Microsoft Access数据库
I need some code in my c# application to implement a transaction using Microsoft Access database
推荐答案
OleDbTransaction类是由只为那。你可以通过调用的BeginTransaction您OleDbConnection对象上,然后提交或回滚到您的方案
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.
这篇关于建立在C#中的MS Access交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文