The below code snippet shows you that adding primary key to datatable.
dt.PrimaryKey = new System.Data.DataColumn[] { dt.Columns[1] };
//Where dt is the DataTable and the number "1" indicates which column should have primary key.
//Here I have used 1st column of the DataTable, need the Primary Key. Instead you can use as
// dt.Columns["your-column-name"] can be used.