在Visual Studio中更新tableadapter数据库
我试图让我的程序使用事件处理程序和tableadapters将一行添加到数据库。我可以成功添加一行到数据库,但是当我单击“btnRefresh”按钮时它不会保存。这是事件处理程序的代码。在Visual Studio中更新tableadapter数据库
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click Try
Validate()
CarsBindingSource.EndEdit()
CarsTableAdapter.Update(Me.ABVDataSet.Cars)
MsgBox("Refreshed Successfully")
Catch ex As Exception
MsgBox("Update failed")
End Try
End Sub
回答:
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click Try Validate() CarsBindingSource.EndEdit() CarsTableAdapter.Update(ABVDataSet,"table_name") MsgBox("Refreshed Successfully") Catch ex As Exception MsgBox("Update failed") End Try End Sub
以上是 在Visual Studio中更新tableadapter数据库 的全部内容, 来源链接: utcz.com/qa/258545.html