Find in ADO.net

  • Thread starter Thread starter Robert A. Boudra
  • Start date Start date
R

Robert A. Boudra

I'm looking for the equivalent of the Find method from ADO in ADO.net. It
appears that the Find method in .Net only works on the Key field. How do I
search for the first record in a DataTable that meets a given criteria?
 
One way is to create a DataView and set its rowfilter to the value that you
are looking for
 
Hi Robert,

There's a find method in a dataview that does not rely on the PK. Here's a
skeleton:
Dim arrayseeks(0) As Object

Dim ifinds As Integer

Dim vues As New DataView(dsshipcode.Tables(0))

vues.Sort = "shipcode"

For Each irowd In dsmani_lbld.Tables(0).Rows

qcounter = 0

For Each irow In dsmani_lbl.Tables(0).Rows

arrayseeks(0) = irow("shipcode")

ifinds = vues.Find(arrayseeks)

If ifinds <> -1 Then ' ie, found it

mdescrip = vues(ifinds)("descrip")

Else

mdescrip = ""

End If

Next

Let me know if you have any questions.

HTH,

Bernie Yaeger
 
Back
Top