System.Data.DataSet.RejectChanges C# (CSharp) Метод

RejectChanges() публичный Метод

This method rolls back all the changes to have been made to this DataSet since it was loaded or the last time AcceptChanges was called. Any rows still in edit-mode cancel their edits. New rows get removed. Modified and Deleted rows return back to their original state.
public RejectChanges ( ) : void
Результат void
        public virtual void RejectChanges()
        {
            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataSet.RejectChanges|API> {0}", ObjectID);
            try
            {
                bool fEnforce = EnforceConstraints;
                EnforceConstraints = false;
                for (int i = 0; i < Tables.Count; i++)
                {
                    Tables[i].RejectChanges();
                }
                EnforceConstraints = fEnforce;
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }

Usage Example

Пример #1
0
 public static void EditFallidasRemoteServer(DataSet dt, ref int? codigoError, bool grabarFallidas)
 {
     MySqlTransaction tr = null;
     try
     {
         MySqlConnection SqlConnection1 = DALBase.GetRemoteConnection();
         SqlConnection1.Open();
         DAL.FondoCajaDAL.GrabarDB(dt, SqlConnection1);
         SqlConnection1.Close();
         BL.FallidasBLL.BorrarFondoCajaFallidasByAccion("Modified");
     }
     catch (MySqlException ex)
     {
         if (ex.Number == 1042) //no se pudo abrir la conexion por falta de internet
         {
             dt.RejectChanges();
             codigoError = 1042;
         }
         else
         {
             dt.RejectChanges();
             if (tr != null)
             {
                 tr.Rollback();
             }
             codigoError = ex.Number;
         }
     }
     catch (TimeoutException)
     {
     }
 }
All Usage Examples Of System.Data.DataSet::RejectChanges