Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBConcurrency Exception Question...

Status
Not open for further replies.

avarga82

Programmer
May 19, 2003
62
US
Mr. Google is not being of any help on this subject.

I'm building a multi-user app, and need to consider record concurrency. The question: When the DataAdapter.Update throws a DBConcurrencyException, how do I commit the changes that were made?
 
Normally you wouldn't because that would make the changes made by another user to be overwritten and I don't think that is a good idea.

But if you want to do it anyway.
First I would ask if he wants to overwrite the changes made by the other user then I would copy that record into another dataset/datatable, refill the original one recopy the data from the second dataset and update to the database.

Another option would be to tell the user there was a concurrency problem, show him the new data and make him do the changes again if he still wants to.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
I'm planning on prompting the user, but I definitely want a way to commit the changes even if there is a concurrency conflict.

A couple questions:

1.) What's the easiest way to get a dataset of the rows that failed to update? The OnRowUpdated event of the DataAdapter?

2.) How do I refill the original one? DataAdapter.Fill?

3.) How can I merge the 2? OriginalDataSet.Merge(NewDataSet)?

Any help would be appreciated...
 
1) I think that he won't update any of the rows that have been changed. so you would be save to copy all the records you got (or just the changed ones). in th catch section.

2) yep

3) I wouldn't merge just dataset.copy or .clone or something to that effect.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top