none
Binding Navigator not saving changes RRS feed

  • Question

  • Hi,

    I am having problems with the save button on the BindingNavigator not committing the changes to the database.  I have tried it in several projects.  I make a MS Access database with a "Customers" table, FName and LName.  (I have tried both .mdb and .accdb).  Setup up the data source and test successfully.  Pull in the Customer table, set it to details (DGV doesn't work either), drag it onto form1 and try to edit or add new record.  Shows it does, hit the save button, close the application and the change is not there when I come back.

    This should be simple.  I finally went back and tried the Developer network example:

    "msdn.Microsoft.com/en-us/library/0f92s97z"

    Even it does not commit my changes.  I am not getting any errors and it shows the "update successful" message box.  Here is the code from the save button click:

    Try 
        Me.Validate()
        Me.CustomersBindingSource.EndEdit()
        Me.CustomersTableAdapter.Update(Me.NorthwindDataSet.Customers)
        MsgBox("Update successful")
    
    Catch ex As Exception
        MsgBox("Update failed")
    End Try

    Any idea's?

    Thanks.

    Tuesday, May 22, 2018 5:10 PM

All replies

  • Hello,

    Select the database in the project, select "Copy to Output Directory", it should be set to "Copy if newer" for you. Normally it's set to "Copy always" which will wipe out changes on each build.

    See also my MSDN article/code sample.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites


    Tuesday, May 22, 2018 5:30 PM
    Moderator