在我的表单上,我只有2个控件,一个组合框用于保存数据库中每个表的名称,而另一个gridcontrol则用于在组合框中选择表时显示数据。
一旦更改了网格控制单元的值,如何更新数据库表?
这是我的代码,它填充了gridcontrol:
Private Sub comboBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles comboBox.SelectionChanged
gridControl.ItemsSource = returnTable("select * from " & comboBox.SelectedItem("TABLE_NAME"))
End Sub
Public Function returnTable(ByVal queryString As String)
Dim query1 As String = queryString
Dim table As New DataTable
Using connection As New MySqlConnection(konekcija)
Using adapter As New MySqlDataAdapter(query1, connection)
Dim cmb As New MySqlCommandBuilder(adapter)
table.Clear()
adapter.Fill(table)
Return table
End Using
End Using
End Function
答案 0 :(得分:0)
您需要捕获cellvaluechanging事件并按照此说明更新表 https://www.devexpress.com/Support/Center/Question/Details/Q322494/changing-value-on-cellvaluechanging-event