static internal DBSchemaRow[] GetSortedSchemaRows(DataTable dataTable) // MDAC 60609 { DataColumn sortindex = new DataColumn("SchemaMapping Unsorted Index", typeof(Int32)); // MDAC 67050 dataTable.Columns.Add(sortindex); int count = dataTable.Rows.Count; for (int i = 0; i < count; ++i) { dataTable.Rows[i][sortindex] = i; } ; DBSchemaTable schemaTable = new DBSchemaTable(dataTable); const DataViewRowState rowStates = DataViewRowState.Unchanged | DataViewRowState.Added | DataViewRowState.ModifiedCurrent; DataRow[] dataRows = dataTable.Select(null, "ColumnOrdinal ASC", rowStates); Debug.Assert(null != dataRows, "GetSchemaRows: unexpected null dataRows"); DBSchemaRow[] schemaRows = new DBSchemaRow[dataRows.Length]; for (int i = 0; i < dataRows.Length; ++i) { schemaRows[i] = new DBSchemaRow(schemaTable, dataRows[i]); } return(schemaRows); }
/*static internal DBSchemaRow[] GetSchemaRows(DataTable dataTable) { * DBSchemaTable schemaTable = new DBSchemaTable(dataTable); * * const DataViewRowState rowStates = DataViewRowState.Unchanged | DataViewRowState.Added | DataViewRowState.ModifiedCurrent; * DataRow[] dataRows = ADP.SelectRows(dataTable, rowStates); * Debug.Assert(null != dataRows, "GetSchemaRows: unexpected null dataRows"); * * DBSchemaRow[] schemaRows = new DBSchemaRow[dataRows.Length]; * * for (int i = 0; i < dataRows.Length; ++i) { * schemaRows[i] = new DBSchemaRow(schemaTable, dataRows[i]); * } * return schemaRows; * }*/ internal DBSchemaRow(DBSchemaTable schemaTable, DataRow dataRow) { this.schemaTable = schemaTable; this.dataRow = dataRow; }