更新不是表适配器的成员



我正在尝试将数据添加到Visual Basic中的Access数据库中,但是当我尝试运行代码时,我计算了此错误:

错误 1"更新"不是 的成员 'GestiuneStudenti.Gestiune_StudentiDataSetTableAdapters.Gestiune_StudentiTableAdapter'. C:\用户\用户\文档\视觉 演播室 2013\Projects\GestiuneStudenti\GestiuneStudenti\Form1.vb 64 13 GestiuneStudenti

这是我的代码示例

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Try
Gestiune_StudentiBindingSource.EndEdit()
Gestiune_StudentiTableAdapter.Update(Gestiune_StudentiDataSet.Gestiune_Studenti)
MessageBox.Show("Intrarea a fost adaugata cu succes")
Catch ex As Exception
MessageBox.Show("Eroare la adaugarea intrarii")
End Try

我的数据库有 3 个表,其中 2 个带有主键,第三个表将其他 2 个表中的主键作为外键。

谢谢

解决方案:

  • 探索打开 XXXXDataSet.XSD
  • 右键单击表适配器
  • 从菜单配置中选择,然后单击高级选项按钮
  • 单击"生成插入、更新和删除语句"框和"确定"按钮
  • 单击完成按钮

如果你想更新一个数据集,你只需要

Gestiune_StudentiTableAdapter.Update(Gestiune_StudentiDataSet)

我希望它有所帮助

最新更新