Hi. Can someone help me with this? I'm trying to make a code for database to be edited through DataGridView. Here's the code:
Public Class Frm_UA

Dim Connection As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=G:\VB Project\Library Catalog System\Library Catalog System\library.mdf;Integrated; Security=True;Connect Timeout=30;User Instance=True"
Dim a As OleDb.OleDbCommand = New OleDb.OleDbCommand

Private Sub Frm_UA_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'DbVPioDataSet.Ministry_Head' table. You can move, or remove it, as needed.
    Me.Ministry_HeadTableAdapter3.Fill(Me.DbVPioDataSet.Ministry_Head)
    BindingNavigator2.Hide()
End Sub

Private Sub BindingNavigatorSaveItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorSaveItem1.Click
    Me.Validate()
    Me.MinistryHeadBindingSource6.EndEdit()
    Me.TableAdapterManager3.UpdateAll(Me.DbVPioDataSet) - this causes the error
End Sub

Private Sub LnkLbl_UA_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LnkLbl_UA.LinkClicked
    Me.Show()
End Sub

Private Sub LnkLbl_MainMenu_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LnkLbl_MainMenu.LinkClicked
    Frm_MainMenu.Show()
    Me.Hide()
End Sub

Private Sub LnkLbl_Volunteers_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LnkLbl_Volunteers.LinkClicked
    Frm_V.Show()
    Me.Hide()
End Sub

Private Sub LnkLbl_Trainings_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LnkLbl_Trainings.LinkClicked
    Frm_T.Show()
    Me.Hide()
End Sub

Private Sub LnkLbl_MH_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LnkLbl_MH.LinkClicked
    Frm_MH.Show()
    Me.Hide()
End Sub

Private Sub LnkLbl_LogOut_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LnkLbl_LogOut.LinkClicked
    Frm_LogOut.Show()
    Me.Hide()
End Sub

Private Sub Cmd_ChangeUN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_ChangeUN.Click
    If TxtBx_UN.Text = My.Settings.Username And TxtBx_PassUN.Text = My.Settings.Password Then
        My.Settings.Username = TxtBx_ReUN.Text
        My.Settings.Save()
        MsgBox("User Name successfully changed!")
    Else
        MsgBox("User Name or Password is incorrect!")
    End If
End Sub

Private Sub Cmd_ChangePass_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_ChangePass.Click
    If TxtBx_UNPass.Text = My.Settings.Username And TxtBx_PassPass.Text = My.Settings.Password Then
        My.Settings.Username = TxtBx_RePass.Text
        My.Settings.Save()
        MsgBox("Password successfully changed!")
    Else
        MsgBox("User Name or Password is incorrect!")
    End If
End Sub

Private Sub LnkLbl_Add_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LnkLbl_Add.LinkClicked
    Frm_Create.Show()
    Me.Hide()
End Sub


Private Sub Cmd_Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_Save.Click
    BindingNavigatorSaveItem1.PerformClick()
    MsgBox("Updated")
End Sub

Private Sub Cmd_Del_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_Del.Click
    BindingNavigatorDeleteItem1.PerformClick()
    MsgBox("Deleted")
End Sub

End Class

In line #6 you do the following:

Me.Ministry_HeadTableAdapter3.Fill(Me.DbVPioDataSet.Ministry_Head)

Then in line #13:

Me.TableAdapterManager3.UpdateAll(Me.DbVPioDataSet)

Try changing line #13 to:

Me.TableAdapterManager3.UpdateAll(Me.DbVPioDataSet.Ministry_Head)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.