Search by column

  • Thread starter Thread starter Markus
  • Start date Start date
M

Markus

Visual Basic.NET, SQL db
--------------------------------------

objRow = objDataSet.Tables("Owners").Rows.Find
(txtSearch.Text)

Here I'm using Find to search SQL database by primary key.

How do I search this database by row but without primary
key.

I would like to search by column "Name"
 
I think you'll need to use the Select method instead of Find if you aren't
using a PK.

string mySelect = "MyFieldName = '" & txtSearch.Text & "'"

HTH,

Bill
 
Hi Markus,

You can set up a dataview and search on any or several columns:

Dim arrayseeks(0) As Object

Dim ifinds As Integer

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

vues.Sort = "shipcode"

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 problem following this.

HTH,

Bernie Yaeger
 
Back
Top