how to seach a dataset column?

«He pah!! N me digas q és Portugues e q fazes forms com essas cores!!»

Use the RowFilter from the DataView Object...
Visual Basic:
        Dim dv As New DataView(TheDataTableObject)
        dv.RowFilter = "Column1 = 'SearchString'"

Note:
You must set the dataview as the DataSource of the control that will display the results.

Alex :p
 
AlexCode said:
«He pah!! N me digas q és Portugues e q fazes forms com essas cores!!»

Use the RowFilter from the DataView Object...
Visual Basic:
        Dim dv As New DataView(TheDataTableObject)
        dv.RowFilter = "Column1 = 'SearchString'"

Note:
You must set the dataview as the DataSource of the control that will display the results.

Alex :p

ROTFL!!!!! Talvez ele seja português e do Porto ao mesmo tempo!
 
i try a other way ?
what do you think?




Dim dataviewindex as Integer
Dim datasetname as New DataSet("tablename")
Dim instrstr as Integer
Dim i as Integer


Dim dataviewname as DataView = New DataView(datasetname.Tables("tablename"))
dataviewindex = dataviewname.Count()
For i = 0 To dataviewindex - 1
Instrstr = InStrRev(dataviewname(i) ("designação" ), "")
If instrstr <> 0 Then
Msgbox("Found")
Else
Msgbox("Not Found")
End If
Next i

Solução
??
Thank s
 
How come did you discard my and adopt this one!!

You can replace this 10 line, lazzy code with only this:

Visual Basic:
dv.RowFilter = "ColumnName LIKE '*product*'"
If dv.Count = 0 Then
     MessageBox.Show("Not Found")
Else
     MessageBox.Show("Found")
End If

Search for DataColumn.Expression Property on VS Help for more possible operations...

Clearlly you're a VB6 programmer, almost everything has changed, including the sintax and most importantly the way of thinking since VB6... Allways seek the way it will work faster... not the faster way to put it to work... ok?

Alex :p
 
thank you

i didn´t discarge your´s im tryng doing something that i don´t realy now how?

thank´s
your code is better and if i whant to add 2 RadioButton and get the "selection" from the textbox?!
Thank´s
 
Back
Top