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

14,390

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

Share:
14,390
Slim
Author by

Slim

Updated on June 24, 2022

Comments

  • Slim
    Slim almost 2 years

    if so how?