我目前在将数据从Visual Basic导出到Ms Access文件时遇到问题。执行我的表单时,我收到以下错误。"更新需要一个有效的UpdateCommand传递带修改行的DataRow集合。它无法将数据导出到Ms Access。
此表单的目的是当用户写入新的用户名和密码时,将其导出到Ms Access数据库并保存。我有另一种形式,正确地从数据库导入数据。
Public Class LoginTestV2
Private Sub LoginTestV2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'DataDataSet.TblUserAccount' table. You can move, or remove it, as needed.
Me.TblUserAccountTableAdapter.Fill(Me.DataDataSet.TblUserAccount)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnCreateAccount.Click
Me.TblUserAccountTableAdapter.Fill(Me.DataDataSet.TblUserAccount)
On Error GoTo SaveErr
TblUserAccountBindingSource.EndEdit()
TblUserAccountTableAdapter.Update(DataDataSet.TblUserAccount)
MsgBox("You have created your account! You're on your way to start Recycling!")
SaveErr:
Exit Sub
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnClose.Click
Me.Close()
End Sub
End Class
答案 0 :(得分:0)
更改访问数据库的安全设置。右键单击访问数据库,然后选中允许所有操作