我正在尝试使用输入表单的数据更新访问数据库。当我点击插入按钮时,它会以另一种形式更新datagridview(因此我可以看到数据),但它不会填充数据库。我错过了什么?
Dim newCoinsRow As CoinsDatabaseDataSet.CoinsRow
newCoinsRow = frmCollection.CoinsDatabaseDataSet.Coins.NewCoinsRow
newCoinsRow.Name = strName
newCoinsRow.Year = intYear
newCoinsRow.FaceValue = decFaceValue
newCoinsRow.Currency = strCurrency
newCoinsRow.Metal = strMetal
newCoinsRow.Weight = decWeight
newCoinsRow.Value = decValue
newCoinsRow.IsEncapsulated = boolEncapsulated
frmCollection.CoinsDatabaseDataSet.Coins.Rows.Add(newCoinsRow)
frmCollection.CoinsTableAdapter.Update(frmCollection.CoinsDatabaseDataSet.Coins)
在带有数据网格视图的表单中,我有:
Private Sub frmCollection_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.CoinsTableAdapter.Fill(Me.CoinsDatabaseDataSet.Coins)
End Sub