// Create the DataColumn list for holding the columns of the primary keys. In this case, we are using only one primary key DataColumn[] primaryKeyColumns = new DataColumn[1]; // Set the first primary key to the column 'id' in the datatable primaryKeyColumns[0] = myDataTable.Columns["id"]; // Now apply the primary key to the datatable myDataTable.PrimaryKey = primaryKeyColumns;
You need to create an account or log in to post comments to this site.