0

我正在使用带有 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();
            }
4

0 回答 0