-
Mar 13th, 2019, 12:04 PM
#1
Thread Starter
New Member
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
-
Mar 13th, 2019, 04:02 PM
#2
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.
-
Mar 13th, 2019, 04:02 PM
#3
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.
-
Mar 13th, 2019, 05:50 PM
#4
Re: changes not been commited to my database
Originally Posted by Allaye
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|