I have a datatable
with data. I want to add composite primary key
to this table (say on 2 columns) and check if any row in the datatable validates the composite primary key we set.
What I have done is I have added composite primary key to the datatable
DataColumn[] keys = new DataColumn[2];
keys[0] = dt.Columns["EmpId"];
keys[1] = dt.Columns["EmpName"];
dt.PrimaryKey = keys;
But I am not able to figure out how to check existing data and set RowError of respective rows.