Remove primary key in datatable

Viewed 22558

is there a way to remove primary key from the datatable Or is there any way to remove the constraints of "PK" first and then remove the column itself?

Thanks!

UPDATED:

 dtTable.Columns.Add(new System.Data.DataColumn("PRIMARY_KEY", typeof(System.Int32)));
 dtTable.PrimaryKey = new DataColumn[1] { dtTable.Columns["PRIMARY_KEY"] }; // throws an error
 dtTable.Columns["PRIMARY_KEY"].AutoIncrement = true;
2 Answers
Related