Link to home
Create AccountLog in
Avatar of Karolina Sanovic
Karolina Sanovic

asked on

how to remove error in database

when I want to save in my database I have error,how to fix that,I am working in Visual Basic.I can save only one information,when I try to save another then I get the error note
screen-22.56.45-09.04.2017-.png
screen-23.01.32-09.04.2017-.png
WP_20170411_001.jpg
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

What I see is: Button35 uses BindingSource5  and  Button29 uses BindingSource4.
What exactly are you updating in _MyDatabase_4DataSet4  and  in _MyDatabase_4DataSet5?
If you are updating same tables then it can complain about the concurrency because one data set can contain obsolete data which were updated in the database by the previous/another UpdateAll call.

OR are you talking about the first UpdateAll success and the second UpdateAll for the same data set (same button) fails? Then you have to look into the database after the first save and confirm everything was saved correctly and then solve possible saving problems.
Avatar of Karolina Sanovic
Karolina Sanovic

ASKER

I have 6 pages and they all have the same datatable(I have template named solina1).When I use last 2 pages and insert data and click save they (sepperatly using) save in datatable,but when I put another data and try to save (same button) I have error.
First 4 pages dont work at all when try saving,they save only when I press button add new.
I put the code for all pages the same but something is wrong.
screen-datatables.png
screen-datasource.png
here are codes for first and last page
screen-first-page-code.png
screen-last-page-code.png
The code for all pages isn't the same because you are using different data sets. You can do it this way when these data sets are working on different data tables (on SQL backend). Once you have two data sets connected to the same data then the concurrency problem appears because data updated in one data set are not copied to other data sets and the application logic refuses saving because it evaluates it as data changed by other users.

You should redesign it. All your pages should use just ONE global dataset so they are all displaying the data from one source. Also, if you are displaying some information on more pages then you should always refresh this info when switching between pages.
I am a beekeeper and I make this form for keeping information of bees.
6 pages is for different places where we keep bees,but they have same datatables because we need to save same informations (same questions) for all places but each page sould save information for itself.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer