Help with vb.net code save button to a sql database using datagridview

Hello. I am fairly new to programming and I am learning vb.net. I am currently using visual studio 2017 community. I created a form the contains entry fields along with a dataviewgrid that stores the information based on what was entered in the text boxes. The data is being stored on a sql database (2008). My form has two buttons. An add new button and save button. Basically I enter info in my text boxes then hit the add button, This populates my data grid. The issue I am having is with my save button. When I press the save button I received the following error:

System.InvalidOperationException: 'Update requires a valid updatecommand when passed datarow collection with modified rows. I don't know how to correct this? Below is my simple code if it helps.

Public Class Form1
    Private Sub CamTagIssueBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles CamTagIssueBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.CamTagIssueBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.ControlledItemsDataSet)

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'ControlledItemsDataSet.CamTagIssue' table. You can move, or remove it, as needed.
        Me.CamTagIssueTableAdapter.Fill(Me.ControlledItemsDataSet.CamTagIssue)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        CamTagIssueBindingSource.AddNew()
        CameraTextBox.Focus()



    End Sub

    Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click
        Me.Validate()
        Me.CamTagIssueBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.ControlledItemsDataSet)

    End Sub
End Class
DJ PAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
If you're using a TableAdapter or DataAdapter, then you have to set the various "commands" for that adapter. There are several - INSERT, UPDATE, DELETE - and they are, essentially, SQL Statements that perform those tasks.

Here's a link that might help: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/updating-data-sources-with-dataadapters

That contains links which explains how to create those commands.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.