I have this code that executes a SQL:
strsql = "select Nome, Senha from users where Nome=@field1 and Senha=@field2"
objcmd = New Data.MySqlClient.MySqlCommand(strsql, objconn)
With objcmd
.Parameters.AddWithValue("@field1", "valor1")
.Parameters.AddWithValue("@field2", "valor2")
End With
objcmd.ExecuteNonQuery()
objdr = objcmd.ExecuteReader
If (objdr.Read()) Then
MsgBox("Sucesso.")
Else
MsgBox("Erro desconhecido.")
End If
objcmd.Dispose()
objdr.Close()
I want to know, how can I get a value, for example the Name and put in a variable ( get the value of the column and pass it to a string )?