Access数据库的事务范围

时间:2012-12-29 21:38:52

标签: c# .net transactions transactionscope

我正在使用带有c#windows应用程序的Access数据库。我的应用程序使用不同的方法来更新不同的数据库表。我想让我的代码块事务处理,但访问不支持TransactionScope。还有其他方法吗?

我现有的代码示例:

using (TransactionScope scope = new TransactionScope())
            {
                //If customer exists update it else Register new customer
                if (Customer.IsCustomerExists(cname) == true)
                    Customer.UpdateCustomerInfo(cname, cell, mobile, phone);
                else
                    Customer.RegisterNewCustomer(cname, cell, mobile, phone);

                //If source station not exists, Register new station
                if (Station.IsStationExists(source) == false)
                    Station.RegisterNewStation(source);

                //If destination station not exists, Register new station
                if (Station.IsStationExists(destination) == false)
                    Station.RegisterNewStation(destination);

                scope.Complete();
            }

0 个答案:

没有答案