Below is a sample code on how you can retrieve one record in MS SQL using Visual Basic. This is just one way of doing it.
--------------------------------------------------------------------------------------
Dim SQLStr As String = "SELECT * FROM Master where code =" + txtcode.text
Using connection As New SqlConnection(ConnectionString)
Dim SQLCmd As New SqlCommand(SQLStr, connection)
connection.Open()
Dim SQLdr As SqlDataReader = SQLCmd.ExecuteReader()
If SQLdr.Read()
Txtname.text = (SQLdr("name").ToString)
End If
SQLdr.Close()
'no need to close connection here
End Using
----------------------------------------------------------------------------------------