zoukankan      html  css  js  c++  java
  • SqlHelper中使用事务

    SqlParameter[]   signOnParms   =   GetSignOnParameters();  
      SqlParameter[]   accountParms   
    =   GetAccountParameters();  
      SqlParameter[]   profileParms   
    =   GetProfileParameters();  
       
      signOnParms[
    0].Value   =   acc.UserId;  
      signOnParms[
    1].Value   =   acc.Password;  
       
      SetAccountParameters(accountParms,   acc);  
      SetProfileParameters(profileParms,   acc);  
       
      
    using   (SqlConnection   conn   =   new   SqlConnection(SQLHelper.CONN_STRING_NON_DTC))   {  
      conn.Open();  
      
    using   (SqlTransaction   trans   =   conn.BeginTransaction())   {  
      
    try   {  
      SQLHelper.ExecuteNonQuery(trans,   CommandType.Text,   SQL_INSERT_SIGNON,   signOnParms);  
      SQLHelper.ExecuteNonQuery(trans,   CommandType.Text,   SQL_INSERT_ACCOUNT,   accountParms);  
      SQLHelper.ExecuteNonQuery(trans,   CommandType.Text,   SQL_INSERT_PROFILE,   profileParms);  
      trans.Commit();  
       
      }
    catch   {  
      trans.Rollback();  
      
    throw;  
      }
      
      }
      
      }

  • 相关阅读:
    CSS hack:针对IE6,IE7,firefox显示不同效果
    让IE6支持png24透明/半透明的方法
    IE8的css hack
    jQuery Mobile笔记三
    jQuery Mobile笔记二
    js常见面试题
    CSS3-transform3D
    CSS3-transform-style
    CSS3-媒体类型
    CSS3-盒模型-resize属性
  • 原文地址:https://www.cnblogs.com/dudu837/p/1587617.html
Copyright © 2011-2022 走看看