I populate an object datatableusing dataadapterpulling data from a database MS-SQL. For some reason, the wrong column is set as the primary key in the datatable. I tried FillSchemaand to MissingSchemaAction.AddWithKeyno avail.
The correct primary key is correctly defined in the SQL server DB schema and is supported by a unique index PK_xwithout clustering.
The column selected as the primary key using the data adapter is a unique column supported by a clustered unique index.
These are only two columns in the table.
How does DataAdapter retrieve table schema from SQL? I polled the sys tables (sys.tables, sys.index_columns, sys.indexes) and they indicate the correct primary key scheme. What gives?
source
share