Searching a dataset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a DataSet.DataTable already loaded with values that I want to search for some information. What is the best way to go about doing it. Basically I want to know what DataSet.DataTable.Rows(intSomeRow).Item("Name") is when DataSet.DataTable.Rows(intSomeRow).Item("ID") = SomeID. I know I can do a For Each DataRow to loop and look for a matching ID. Is that the best way?
 
You can also use the Select Method...


Sean said:
I have a DataSet.DataTable already loaded with values that I want to
search for some information. What is the best way to go about doing it.
Basically I want to know what
DataSet.DataTable.Rows(intSomeRow).Item("Name") is when
DataSet.DataTable.Rows(intSomeRow).Item("ID") = SomeID. I know I can do a
For Each DataRow to loop and look for a matching ID. Is that the best way?
 
Hi Sean,

The best way in my opinion, although I always say that does not exist, is in
general using the dataview, the dataview.sort and the dataview.rowfilter.

That is the fastest (when you use this sequence).

Alternativly the datatable.select as CJ stated or if it is the primary key
the datarowcollection.seek

I hope this helps?

Cor.
 
Back
Top