3

In my code there is a data row. Is there a way to get the primary key from this or no? My code is:

var PK = data_row.PrimaryKey;

However, this I looked up in the MS docs and there is no PrimaryKey property if a data row, there is a property like that for the data table but I don't have the data table here.

1 Answers1

6

You could try the following:

var PK = data_row.Table.PrimaryKey;

this gets the primary key column from the DataTable that the DataRow comes from.

G. LC
  • 794
  • 1
  • 8
  • 27