System.Data.DataView.CreateChildView C# (CSharp) Метод

CreateChildView() приватный Метод

private CreateChildView ( DataRelation relation, int index ) : DataView
relation DataRelation
index int
Результат DataView
		internal DataView CreateChildView (DataRelation relation, int index)
		{
			if (relation == null || relation.ParentTable != Table)
				throw new ArgumentException("The relation is not parented to the table to which this DataView points.");

			int record = GetRecord (index);
			object[] keyValues = new object [relation.ParentColumns.Length];
			for (int i = 0; i < relation.ParentColumns.Length; i++)
				keyValues [i] = relation.ParentColumns [i] [record];

			return new RelatedDataView (relation.ChildColumns, keyValues);
		}

Usage Example

Пример #1
0
        /// <include file='doc\DataRowView.uex' path='docs/doc[@for="DataRowView.this1"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Gets or sets a value in a specified column.
        ///    </para>
        /// </devdoc>
        public object this[string property] {
            get {
                if (dataView.Table.Columns.Contains(property))
                {
                    return(row[property, dataView.IsOriginalVersion(this.index) ? DataRowVersion.Original : DataRowVersion.Default]);
                }
                else if (dataView.Table.DataSet != null && dataView.Table.DataSet.Relations.Contains(property))
                {
                    return(dataView.CreateChildView(property, index));
                }

                throw ExceptionBuilder.PropertyNotFound(property, dataView.Table.TableName);
            }
            set {
                if (!dataView.Table.Columns.Contains(property))
                {
                    throw ExceptionBuilder.SetFailed(property);
                }
                if (!dataView.AllowEdit && (row != dataView.addNewRow))
                {
                    throw ExceptionBuilder.CanNotEdit();
                }
                SetColumnValue(dataView.Table.Columns[property], value);
            }
        }
All Usage Examples Of System.Data.DataView::CreateChildView