当前位置:数据库 > SQLServer >>

EXTASPNET C# ASP.NET sql server 事务超时,解决方法

[csharp]
private bool SaveAll() 
       { 
           <span style="color:#ff0000;">TransactionOptions transactionOption = new TransactionOptions();  
           transactionOption.Timeout = new TimeSpan(0, 0, 600); 
           using (TransactionScope tscope = new TransactionScope(TransactionScopeOption.Required, transactionOption))</span> 
           { 
               using (SharedDbConnectionScope scope = new SharedDbConnectionScope()) 
               { 
                   try 
                   { 
                       //语句 
                       tscope.Complete(); 
 
                       return true; 
                   } 
                   catch (Exception Ee) 
                   { 
                       tscope.Dispose(); 
                       logger.Warn(string.Format("错误:错误描绘“{0}”", Ee.Message)); 
                       return false; 
                   } 
               } 
           } 
       } 
作者:dxh_0829
补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,