This simple function can be used to get value from exactly one field one record query result
Public Function getDataScalar(ssql As String)
openConnection()
Try
Dim q As New MySqlCommand
q.Connection = db
q.CommandText = ssql
getDataScalar = q.ExecuteScalar
Catch ex As Exception
'Exception
End Try
End Function
How to use it:
Dim userid as String = getDataScalar("select username from user where userid=99")
Variable 'username' would be filled with the value of field username as a result from that query.