Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use DataTable.Contains(object key) if your datatable's primary key is two columns?

if so how?

like image 507
Slim Avatar asked Oct 14 '22 15:10

Slim


1 Answers

To select by a primary key you should use one of:

  • DataTable.Rows.Find(Object) in case your PK is one column
  • DataTable.Rows.Find(Object[]) in case you have more then 1 column as a primary key

In case of a typed DataSet, the method MyDataTable.Rows.Find(...) will be generated for you with the proper signature. Basically it is a method on DataRowCollection class

like image 129
van Avatar answered Oct 20 '22 01:10

van