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
Post a Comment