I have a datatable. I need to fetch a certain column value based on the user input. For example, lets say the datatable has two columns CountryID and CountryName.
I
Datatables have a .Select method, which returns a rows array according to the criteria you specify. Something like this:
Dim oRows() As DataRow
oRows = dtCountries.Select("CountryName = '" & userinput & "'")
If oRows.Count = 0 Then
' No rows found
Else
' At least one row found. Could be more than one
End If
Of course, if userinput contains ' character, it would raise an exception (like if you query the database). You should escape the ' characters (I use a function to do that).