// No impact on AutoIncrementCurrent if over written internal int CopyRecord(DataTable src, int record, int copy) { if (record == -1) { return(copy); } Debug.Assert(src != null, "Can not Merge record without a table"); int newRecord = copy; if (copy == -1) { newRecord = table.NewUninitializedRecord(); } for (int i = 0; i < table.Columns.Count; ++i) { DataColumn objColumn = table.Columns[i]; int iSrc = src.Columns.IndexOf(objColumn.ColumnName); if (iSrc >= 0) { SetValue(newRecord, i, src.Columns[iSrc][record, false]); } else { if (copy == -1) { objColumn.Init(newRecord); } } } return(newRecord); }
// No impact on AutoIncrementCurrent if over written internal int CopyRecord(DataTable src, int record, int copy) { Debug.Assert(src != null, "Can not Merge record without a table"); if (record == -1) { return(copy); } int newRecord = -1; try { if (copy == -1) { newRecord = table.NewUninitializedRecord(); } else { newRecord = copy; } int count = table.Columns.Count; for (int i = 0; i < count; ++i) { DataColumn dstColumn = table.Columns[i]; DataColumn srcColumn = src.Columns[dstColumn.ColumnName]; if (null != srcColumn) { object value = srcColumn[record]; ICloneable cloneableObject = value as ICloneable; if (null != cloneableObject) { dstColumn[newRecord] = cloneableObject.Clone(); } else { dstColumn[newRecord] = value; } } else if (-1 == copy) { dstColumn.Init(newRecord); } } } catch (Exception e) { // if (Common.ADP.IsCatchableOrSecurityExceptionType(e)) { if (-1 == copy) { FreeRecord(ref newRecord); } } throw; } return(newRecord); }
internal int CopyRecord(DataTable src, int record, int copy) { if (record == -1) { return(copy); } int num = -1; try { if (copy == -1) { num = this.table.NewUninitializedRecord(); } else { num = copy; } int count = this.table.Columns.Count; for (int i = 0; i < count; i++) { DataColumn column = this.table.Columns[i]; DataColumn column2 = src.Columns[column.ColumnName]; if (column2 != null) { object obj2 = column2[record]; ICloneable cloneable = obj2 as ICloneable; if (cloneable != null) { column[num] = cloneable.Clone(); } else { column[num] = obj2; } } else if (-1 == copy) { column.Init(num); } } } catch (Exception exception) { if (ADP.IsCatchableOrSecurityExceptionType(exception) && (-1 == copy)) { this.FreeRecord(ref num); } throw; } return(num); }