csi
csi

Reputation: 37

Update is not a member of tableadapter

I'm trying to add data into my Access database in Visual Basic, but I encount this error when I try to run my code:

Error 1 'Update' is not a member of 'GestiuneStudenti.Gestiune_StudentiDataSetTableAdapters.Gestiune_StudentiTableAdapter'. C:\Users\User\Documents\Visual Studio 2013\Projects\GestiuneStudenti\GestiuneStudenti\Form1.vb 64 13 GestiuneStudenti

Here is a sample of my code

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

My database has 3 tables, 2 with primary key, and the third one with the primary keys from the other 2 tables as foreign key.

Thanks

Upvotes: 1

Views: 1396

Answers (2)

Tim
Tim

Reputation: 46

Solution:

  • Explore open the XXXXDataSet.XSD
  • Right click the TableAdapter
  • Choose from the menu Configure and click the Advanced Options button
  • Click the Generate Insert, Update and Delete Statement Box and the Okay Button
  • Click the Finish Button

Upvotes: 3

Romeo Berenyi
Romeo Berenyi

Reputation: 17

If you want to update a dataset you only need thses

Gestiune_StudentiTableAdapter.Update(Gestiune_StudentiDataSet)

I hope it help

Upvotes: 1

Related Questions