Пример #1
0
 private static int[] GetColumnOrdinals(DataColumn[] dc, TAdoDotNetDataTable TargetTable)
 {
     int[] Result = new int[dc.Length];
     for (int i = 0; i < Result.Length; i++)
     {
         Result[i] = TargetTable.GetColumn(dc[i].ColumnName);
     }
     return(Result);
 }
Пример #2
0
        public override TRelation GetRelationWith(VirtualDataTable aDetail)
        {
            TAdoDotNetDataTable AdoDetail = aDetail as TAdoDotNetDataTable; //DataRelationships only happen between DataTables.

            if (AdoDetail != null && OriginalTable.ChildRelations != null)
            {
                foreach (DataRelation dr in OriginalTable.ChildRelations)
                {
                    if (dr.ChildTable == AdoDetail.OriginalTable)
                    {
                        return(new TRelation(this, AdoDetail, GetColumnOrdinals(dr.ParentColumns, this), GetColumnOrdinals(dr.ChildColumns, AdoDetail)));
                    }
                }
            }

            return(null);
        }