System.Data.DataRelation.GetChildRows C# (CSharp) Method

GetChildRows() static private method

Gets the child rows for the parent row across the relation using the version given
static private GetChildRows ( DataKey parentKey, DataKey childKey, DataRow parentRow, DataRowVersion version ) : System.Data.DataRow[]
parentKey DataKey
childKey DataKey
parentRow DataRow
version DataRowVersion
return System.Data.DataRow[]
        internal static DataRow[] GetChildRows(DataKey parentKey, DataKey childKey, DataRow parentRow, DataRowVersion version)
        {
            object[] values = parentRow.GetKeyValues(parentKey, version);
            if (IsKeyNull(values))
            {
                return childKey.Table.NewRowArray(0);
            }

            Index index = childKey.GetSortIndex((version == DataRowVersion.Original) ? DataViewRowState.OriginalRows : DataViewRowState.CurrentRows);
            return index.GetRows(values);
        }

Usage Example

Beispiel #1
0
 internal void CheckCanRemoveParentRow(DataRow row)
 {
     if (this.Table.DataSet.EnforceConstraints && (DataRelation.GetChildRows(this.ParentKey, this.ChildKey, row, DataRowVersion.Default).Length > 0))
     {
         throw ExceptionBuilder.RemoveParentRow(this);
     }
 }
All Usage Examples Of System.Data.DataRelation::GetChildRows