@
omanel

Originally Posted by
omanel
Bumping in order to get an awnser if possible.
Btw,if there were like 3 results, is there a way I could set first result "John" to variable var1, second result Patrick to variable var2 and 3rd result carlos to variable var3?
When you are looping through the reader results, it will return all results it finds.
[highlight="VB.Net"]
'shows a messagebox for each row found
While reader.read
Msgbox(reader("FirstName"))
End While
[/highlight]
You can also save all found entrys in a list or so.
[highlight="VB.Net"]Dim lstNames as new list(of string)
while reader.read
lstNames.add(reader("FirstName"))
end while[/highlight]
Afterwards you can loop through your list.
[highlight="VB.Net"]if lstNames.Count <> 0
for i = 0 to lstNames.Count - 1
msgbox(lstNames(i))
Next
End If[/highlight]
Declare lstNames outside of the sub in order to access it in different subs.
################################################## #######

Originally Posted by
omanel
Also, do you know how I can check if textbox1 has part of a item?
something like
[highlight="vb.net"]Dim sql As String = String.Format("SELECT * FROM tblContacts WHERE FirstName='" + TextBox1.PARTIALText + "'") [/highlight]
so if a item was John and textbox1.text was Joh I could get the John result from using the Joh input/query?
Edit the query.
[highlight="VB.Net"]
Dim sql As String = String.Format("SELECT * FROM tblContacts WHERE FirstName LIKE '%{0}%', Textbox1.Text)
[/highlight]
% is a wildcard. %oh% will find John, Josh, Johan etc. It'll search for results with "oh" inbetween. Change it to {0}% if you just want the part after the search term to be wildcarded.