dotnet2.0开始,增加了System.Transactions的命名空间,数据库的事务可类似以下的方式使用:

            using (TransactionScope s = new TransactionScope())
            
{
                
//To Do
                s.Complete();
            }

这种用法在单机应用没有任何问题,如果进行remoting服务调用,则会报错(报错截屏日后补上。)

问题原因在于,必须启用系统的远程事务,以XP为例,设置方式如下:

posted on 2008-03-31 14:08  老程序员  阅读(234)  评论(0编辑  收藏  举报