c# - DataTable.PrimaryKey columns in different order from Database's primary key -


i'm using sql 2014 database. (also tested in sql 2012 same behavior.) have table primary key columns 'a,b'. columns in create table statement in different order 'b,a'.

when i'm running dataadapter.fillschema(), datatable.primarykey gets set columns in order 'b,a'. expectation columns in order 'a,b' - way primary key ordered in database.

when table created follows, datatable.primarykey in order 'a,b':

drop table alex_test create table alex_test(      [a] [varchar](128) not null,     [b] [varchar](128) not null,     [c] [varchar](128) not null  constraint [pk_alex_test] primary key clustered  (     asc,     b asc ) ) insert alex_test (a, b, c) values('a', 'b', 'c') 

however when table created follows, order of datatable.primarykey 'b,a':

drop table alex_test create table alex_test(      [b] [varchar](128) not null,     [a] [varchar](128) not null,     [c] [varchar](128) not null  constraint [pk_alex_test] primary key clustered  (     asc,     b asc ) ) insert alex_test (a, b, c) values('a', 'b', 'c') 


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -