Results 1 to 4 of 4

Thread: changes not been commited to my database

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2018
    Posts
    5

    changes not been commited to my database

    am actually new to vb and I have been doing this project, everything works well until yesterday when I realized that any changes I made on the application is not been committed to the database, I have changed the dataset property to "copy if newer" but still no change.. I created a new project to see if the problem was with the old project but am still having the same problem with the new one.. please below is my code for saving any changes ..
    Code:
      Try
                Me.Validate()
                Me.ProductTBBindingSource.EndEdit()
                Me.TableAdapterManager.UpdateAll(Me._E_commerceDataSet)
                MsgBox("Saved")
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try

  2. #2
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,684

    Re: changes not been commited to my database

    Using the following

    Dim Result As Integer = Me.TableAdapterManager.UpdateAll(Me._E_commerceDataSet)

    What is the value of Result and do you have a primary auto incrementing primary key for the table(s) as this is needed for updates, inserts and removals.

  3. #3
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,684

    Re: changes not been commited to my database

    Using the following

    Dim Result As Integer = Me.TableAdapterManager.UpdateAll(Me._E_commerceDataSet)

    What is the value of Result and do you have a primary auto incrementing primary key for the table(s) as this is needed for updates, inserts and removals.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: changes not been commited to my database

    Quote Originally Posted by Allaye View Post
    I have changed the dataset property to "copy if newer" but still no change.
    That wouldn't be relevant. Do you actually mean the database, e.g. an Access MDB file or SQL Server MDF file? That would be relevant, in that such a file would be overwritten each time you built the application.

    We need to know EXACTLY how you are determining that nothing is being saved because it's quite possible that changes are being saved and you're just not looking for them correctly. As Karen suggests, testing the result of UpdateAll would be the first thing to do. There are only three possible outcomes for that call. If it is not throwing an exception then it is working as it should and it will either return zero or a non-zero value. If it returns zero then that means that there were no changes to save and if it returns a non-zero value then that means that there were changes and they were saved. Once you know which it is, you know what you should be looking for, i.e. in the former case you need to work out why there's no changes in your DataSet and, in the latter case, you need to work out why you are apparently unable to find the saved changes when you look for them.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width