Kalel Kalel - 16 days ago 7
Vb.net Question

How do I use the find method of a datatable with a compound key?

I am working on a windows form application. How do i use the find method of a datatable to find a row if the datatable has a compound key?

Table Structure
Col A, Col B, Col C

Col A and Col B make up the compound key.
I want to find the row where the value in Col A is 6 and Col B is 5

Answer

There is an overload that you can use to pass in two different values to the find method. Here is the MSDN doc.

So you would most likely be doing something like.

DataTable.Rows.Find(6,5)