BindingSource.Endedit()不会将数据保存到数据集VB.Net

时间:2015-12-23 07:07:07

标签: vb.net dataset bindingsource

我必须在我的数据集中保存库存。当我在当前表单中工作时,我的bindigsource正确更新。它显示了我的更新库存。但是在我重新启动该表单后,数据尚未更新到数据集。它们不会出现在网格视图中。我很抱歉我的英语。请帮我将数据保存到数据集中。

 Private Sub AddStockBtn_Click(sender As Object, e As EventArgs) Handles AddStockBtn.Click
  Dim Size, Stock As Integer
  no = StockBindingSource.Count + 1
       StockBindingSource.AddNew()
       StockBindingSource.Current("No") = no
       StockBindingSource.Current("ShoeID") = IDBox.Text
   For i As Integer = 0 To ShoeDataBindingSource.Count - 1
     Dim rowData As DataRowView = ShoeDataBindingSource.Item(i)
   If rowData("ShoeID").ToString = IDBox.Text Then
     StockBindingSource.Current("ShoeType") = ShoeDataBindingSource.Current("Type")
     StockBindingSource.Current("Description") = ShoeDataBindingSource.Current("Name")
   End If
   Next
      StockBindingSource.Current("Size") = Size
      StockBindingSource.Current("Stock") = Stock
      StockBindingSource.EndEdit()
      TableAdapterManager.UpdateAll(Me.SilexDatabaseDataSet)
   End Sub

0 个答案:

没有答案