I've designed a form in VB.net based on ODBC connection.
My user need to insert a product number in textbox1 and the description pulled from the DB is automatically shown in textbox2 after the user presses the ENTER key.
After seeking on the net, I wrote something that doesn't work.
Private Sub Product_TextChanged(sender As Object, e As EventArgs) Handles Product.TextChanged
Dim P, SQL As String
Dim cn As OdbcConnection
Dim cmd As OdbcCommand
P = Product.Text
If P = "" Then
Exit Sub
Else
cn = New OdbcConnection("Driver={Microsoft ODBC for Oracle}; Server=*****; uid=*****;pwd=*****")
SQL = "select part_long_name from dbtrans.parts where part_code='" & P & "'"
cn.Open()
cmd = New OdbcCommand(SQL)
Description.Text = cmd.ToString
End If
End Sub
When I run the form, I receive this output