コード例 #1
0
 public static void UpdateEmployee(Employee employee)
 {
     try
     {
         CommonDAL.UpdateData(CommonSQLStrings.UpdateEmployeeQuery(employee));
     }
     catch (Exception ex) { throw new Exception(ex.Message.ToString()); }
 }
コード例 #2
0
 internal static void UpdateData(Employee employee)
 {
     using (SqlConnection con = new SqlConnection(DBConnection.TheInstance.GetConnectionString()))
     {
         SqlTransaction tran = null;
         try
         {
             con.Open();
             tran = con.BeginTransaction();
             CommonDAL.UpdateData(CommonSQLStrings.UpdateEmployeeQuery(employee), con, tran);
             tran.Commit();
         }
         catch (Exception ex) { if (tran != null)
                                {
                                    tran.Rollback();
                                }
                                throw new Exception(ex.Message.ToString()); }
         finally { con.Close(); }
     }
 }