数据绑定似乎自行消除

时间:2018-04-27 13:11:41

标签: .net vb.net

我有一个像这样的BindingSource:

BindingSource.DataSource = DataSet.Tables("TableName")

我的BindingSource.PositionChanged事件运行良好,但在运行以下代码后停止触发,我不确定原因:

'I'm trying to send my updates and then retreive any updates using this (very poorly written, I'm sure) code here.
Using DataAdapter As New MySqlDataAdapter("SELECT * FROM MyGreatTable", MySQLConn)
    Dim myCommandBuilder As New MySqlCommandBuilder(DataAdapter)
    CType(BindingSource.Current, DataRowView)("myTime") = Now
    BindingSource.EndEdit()
    DataAdapter.Update(DataSet.Tables("TableName"))
    DataSet.Tables("TableName").Rows.Clear()
    DataAdapter.Fill(DS.Tables("TableName"))
    myDateTime = Convert.ToDateTime(DataSet.Tables("TableName").Compute("Max(myTime)", Nothing))
End Using

有谁知道为什么会这样?

编辑:好的,按照Plutonix,我删除了DataSet.Tables(“TableName”)。Rows.Clear()。我现在遇到了另一个错误...... enter image description here

0 个答案:

没有答案