private static DataRow FindRow(BaseTypedDictionary row, DataTable table) { DataColumn[] tableKeys = table.PrimaryKey; object[] rowKeys = new object[tableKeys.Length]; for (int i = 0; i < tableKeys.Length; i++) { DataColumn tableKey = tableKeys[i]; string keyName = tableKey.ColumnName; rowKeys[i] = row[keyName]; } return table.Rows.Find(rowKeys); }
private static void CopyToRow(BaseTypedDictionary dictionary, DataRow row) { foreach (KeyValuePair<string, object> kvp in dictionary) { DataColumn col = row.Table.Columns[kvp.Key]; if ((col != null) && !col.ReadOnly && !col.AutoIncrement) { row[col] = kvp.Value; } } }