帮助这是一个正在运行的代码,在下拉列表中读取数据,但如果我将其更改为,该怎么办? 在文本框中读取数据。什么是最简单的代码?任何人都可以建议或帮助我? 拜托,因为我的代码总是错误而且没有阅读
Private Sub cmbrevlvl_DropDown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.DropDown
Try
disconnect()
connect()
da = New Odbc.OdbcDataAdapter("Select lname FROM tblemployee WHERE emp_id ='" & Trim(TextBox1.Text.TrimEnd()) & "'", con)
dt = New DataTable
da.Fill(dt)
If dt.Rows.Count Then
With ComboBox1
.DataSource = dt
.DisplayMember = "lname"
.ValueMember = "lname"
End With
Else
' ComboBox1.Enabled = True
ComboBox1.SelectedIndex = -1
End If
Catch ex As Exception
Debug.WriteLine("Plz log in again" & ex.Message)
End Try
End Sub