DataBindings - 文本框和标签(未按预期绑定) [英] DataBindings - Textbox and Label (not binding as expected )
问题描述
推荐答案
Hi Expert,
Hi Expert,
这是我的代码,组合盒子正在找工作。谢谢你的帮助。
This is my code, combo box is working find. thanks for the help.
私人小组TextBox5_TextChanged(发送者为对象,例如作为EventArgs的)处理TextBox5.TextChanged
     试试¥b $ b           Dim table1 As New DataTable
          Dim SDA1 As New SqlDataAdapter
          Dim bSource1 As New BindingSource
          connection.Open()
          Dim query As String
          Dim ds1 As DataSet =新数据集
          query =" select * from SAPCONSUMABLE WHERE描述LIKE'%" &安培; TextBox5.Text& "%'"
          command = New SqlCommand(查询,连接)
          SDA1.SelectCommand = command
          SDA1.Fill(ds1,"SAPCONSUMABLE")
          bSource1.DataSource = table1
          ComboBox3.DataSource = ds1.Tables(" SAPCONSUMABLE")
          ComboBox2.DataSource = ds1.Tables(" SAPCONSUMABLE")
          ComboBox4.DataSource = ds1.Tables(" SAPCONSUMABLE")
          ComboBox5.DataSource = ds1.Tables(" SAPCONSUMABLE")
          SDA1.Update(table1)
          connection.Close()
      Catch ex As SqlException
          MessageBox.Show(ex.ToString)
     结束尝试
 结束子
Private Sub TextBox5_TextChanged(sender As Object, e As EventArgs) Handles TextBox5.TextChanged
Try
Dim table1 As New DataTable
Dim SDA1 As New SqlDataAdapter
Dim bSource1 As New BindingSource
connection.Open()
Dim query As String
Dim ds1 As DataSet = New DataSet
query = "select* from SAPCONSUMABLE WHERE Description LIKE '%" & TextBox5.Text & "%'"
command = New SqlCommand(query, connection)
SDA1.SelectCommand = command
SDA1.Fill(ds1, "SAPCONSUMABLE")
bSource1.DataSource = table1
ComboBox3.DataSource = ds1.Tables("SAPCONSUMABLE")
ComboBox2.DataSource = ds1.Tables("SAPCONSUMABLE")
ComboBox4.DataSource = ds1.Tables("SAPCONSUMABLE")
ComboBox5.DataSource = ds1.Tables("SAPCONSUMABLE")
SDA1.Update(table1)
connection.Close()
Catch ex As SqlException
MessageBox.Show(ex.ToString)
End Try
End Sub
这篇关于DataBindings - 文本框和标签(未按预期绑定)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!