You will need to edit this basic example to reflect your own queries, variables and connection string. If you found this reply helpful, please mark it as a solution. I have pointed out a few things to you in the comments.
This whole line is wrong and one of your problems is the " at the end should be before the , at then end. You should also be using ("Put Query here") blocks.
"SELECT * FROM login_table WHERE username= '" & TextBoxUserName.Text & "' and password= '" & TextBoxPassword.Text & "', cn"
Try this:
Dim SelectID As Integer
Dim UserName As String = "Tom"
Dim iUserGuid As String = "5266-2453-4523-3562"
Dim MysqlConn As MySqlConnection
Dim MySqlConnectionString As String = "http://www.connectionstrings.com/mysql/"
Try
MysqlConn = New MySqlConnection()
MysqlConn.ConnectionString = MySqlConnectionString
Query = "SELECT `session` FROM `databasename`.`yourtablehere` WHERE `username` = @username AND `guid` = @guid;"
Dim QueryComCheck As New MySqlCommand(Query, MysqlConn)
QueryComCheck.Parameters.AddWithValue("@username", UserName)
QueryComCheck.Parameters.AddWithValue("@guid", iUserGuid)
If MysqlConn.State = ConnectionState.Closed Then
MysqlConn.Open()
End If
Using reader As MySqlDataReader = QueryComCheck.ExecuteReader
If reader.HasRows Then
Do While reader.Read()
If CBool(reader.GetString("session")) = True Then
SelectID = CInt(reader.GetString("session"))
End If
Loop
End If
End Using
Catch GetSessionFromUser As Exception
End Try