Когда я выбираю значение из customer no. Поле со списком, оно не отображает имя в текстовом поле.
Private Sub Ocmbcno_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbcno.SelectedIndexChanged Try If cmbcno.SelectedIndex <> -1 Then Dim Reader As OleDbDataReader Call connect() Dim C2_Qry As String = "select * from Customer where C_ID=" & cmbcno.Text & " '" comm.Connection = conn comm.CommandType = CommandType.Text comm.CommandText = C2_Qry Reader = comm.ExecuteReader Reader.Read() txtCname.Text = Reader.Item("cname") otxtcity.Text = Reader.Item("ccity") txtOCB.Text = Reader.Item("cbalance") rdr.Close() cmbPno.Enabled = True End If Catch es As Exception End Try End Sub
Что я уже пробовал:
Ошибка несоответствия типа данных возникает при изменении значения из поля со списком
<pre>Private Sub Ocmbcno_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbcno.SelectedIndexChanged Try If cmbcno.SelectedIndex <> -1 Then Dim Reader As OleDbDataReader Call connect() Dim C2_Qry As String = "select * from Customer where C_ID=" & cmbcno.selectedindex comm.Connection = conn comm.CommandType = CommandType.Text comm.CommandText = C2_Qry Reader = comm.ExecuteReader Reader.Read() txtCname.Text = Reader.Item("cname") otxtcity.Text = Reader.Item("ccity") txtOCB.Text = Reader.Item("cbalance") rdr.Close() cmbPno.Enabled = True End If Catch es As Exception End Try End Sub