Hello
I am trying to display an ID which is a primary key in my table by selecting the corresponding name in my table. the names have been saved in a combo box and depending on the name selected the textbox will display that Id. the code I have so far only gets the names from sql server but doesnt show the id in the textbox.
can you guide me on this please..
this is the code for combobox. i placed it in the formload
Public Sub RtnCmbVal()
Dim conn As SqlConnection
Dim str As String = "select ConsultantId, FullName from Derma_Consultants"
Dim da As SqlDataReader
conn = GetConnection()
Dim ds As New SqlDataAdapter(str, conn)
Dim cmdGet As New SqlCommand(str, conn)
conn.Open()
da = cmdGet.ExecuteReader
While da.Read
consultantcmb.Items.Add(da("FullName"))
End While
End Sub