public void CopyFrom(ITable table, int row) { NewRow(); var columnNames = new ObjectName[table.ColumnCount()]; for (int i = 0; i < columnNames.Length; ++i) { columnNames[i] = table.GetResolvedColumnName(i); } for (int i = 0; i < ColumnCount; ++i) { var v = GetResolvedColumnName(i); var colName = v.Name; try { int columnOffset = -1; for (int n = 0; n < columnNames.Length || columnOffset == -1; ++n) { if (columnNames[n].Name.Equals(colName)) { columnOffset = n; } } var value = table.GetValue(row, columnOffset); SetValue(rowCount - 1, i, value); } catch (Exception e) { throw new InvalidOperationException(e.Message, e); } } }
private void SelectIntoTable(IMutableTable table, ITable result) { if (!AreCompatible(table.TableInfo, result.TableInfo)) { throw new InvalidOperationException(); } for (int i = 0; i < result.RowCount; i++) { var newRow = table.NewRow(); for (int j = 0; j < result.ColumnCount(); j++) { var value = result.GetValue(i, j); newRow.SetValue(j, value); } table.AddRow(newRow); } }
public void CopyFrom(ITable table, int row) { NewRow(); var columnNames = new ObjectName[table.ColumnCount()]; for (int i = 0; i < columnNames.Length; ++i) { columnNames[i] = table.GetResolvedColumnName(i); } for (int i = 0; i < ColumnCount; ++i) { var v = GetResolvedColumnName(i); var colName = v.Name; try { int columnOffset = -1; for (int n = 0; n < columnNames.Length || columnOffset == -1; ++n) { if (columnNames[n].Name.Equals(colName)) { columnOffset = n; } } var value = table.GetValue(row, columnOffset); SetValue(rowCount-1, i, value); } catch (Exception e) { throw new InvalidOperationException(e.Message, e); } } }
private void SelectIntoTable(IMutableTable table, ITable result) { if (!AreCompatible(table.TableInfo, result.TableInfo)) throw new InvalidOperationException(); for (int i = 0; i < result.RowCount; i++) { var newRow = table.NewRow(); for (int j = 0; j < result.ColumnCount(); j++) { var value = result.GetValue(i, j); newRow.SetValue(j, value); } table.AddRow(newRow); } }