System.Data.DataRelation.GetParentRows C# (CSharp) Метод

GetParentRows() статический приватный Метод

Gets the parent rows for the given child row across the relation using the version given
static private GetParentRows ( DataKey parentKey, DataKey childKey, DataRow childRow, DataRowVersion version ) : System.Data.DataRow[]
parentKey DataKey
childKey DataKey
childRow DataRow
version DataRowVersion
Результат System.Data.DataRow[]
        internal static DataRow[] GetParentRows(DataKey parentKey, DataKey childKey, DataRow childRow, DataRowVersion version)
        {
            object[] values = childRow.GetKeyValues(childKey, version);
            if (IsKeyNull(values))
            {
                return parentKey.Table.NewRowArray(0);
            }

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

Usage Example

Пример #1
0
 public DataRow[] GetParentRows(DataRelation relation, DataRowVersion version)
 {
     if (relation == null)
     {
         return(this._table.NewRowArray(0));
     }
     if (relation.DataSet != this._table.DataSet)
     {
         throw ExceptionBuilder.RowNotInTheDataSet();
     }
     if (relation.ChildKey.Table != this._table)
     {
         throw ExceptionBuilder.GetParentRowTableMismatch(relation.ChildTable.TableName, this._table.TableName);
     }
     return(DataRelation.GetParentRows(relation.ParentKey, relation.ChildKey, this, version));
 }