System.Data.DataRow.GetDefaultRecord C# (CSharp) Method

GetDefaultRecord() private method

private GetDefaultRecord ( ) : int
return int
        internal int GetDefaultRecord()
        {
            if (_tempRecord != -1)
            {
                return _tempRecord;
            }
            if (_newRecord != -1)
            {
                return _newRecord;
            }

            // If row has oldRecord - this is deleted row.
            throw _oldRecord == -1 ?
                ExceptionBuilder.RowRemovedFromTheTable() :
                ExceptionBuilder.DeletedRowInaccessible();
        }

Usage Example

Example #1
0
 internal override void CheckConstraint(DataRow row, DataRowAction action)
 {
     if (Table.EnforceConstraints &&
         (action == DataRowAction.Add ||
          action == DataRowAction.Change ||
          (action == DataRowAction.Rollback && row._tempRecord != -1)))
     {
         if (row.HaveValuesChanged(ColumnsReference))
         {
             if (ConstraintIndex.IsKeyRecordInIndex(row.GetDefaultRecord()))
             {
                 object[] values = row.GetColumnValues(ColumnsReference);
                 throw ExceptionBuilder.ConstraintViolation(ColumnsReference, values);
             }
         }
     }
 }
All Usage Examples Of System.Data.DataRow::GetDefaultRecord