Click here to Skip to main content
15,890,512 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Sascha Lefèvre18-Jun-15 11:18
professionalSascha Lefèvre18-Jun-15 11:18 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Dave Kreskowiak18-Jun-15 12:22
mveDave Kreskowiak18-Jun-15 12:22 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc18-Jun-15 12:45
satc18-Jun-15 12:45 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Dave Kreskowiak18-Jun-15 13:19
mveDave Kreskowiak18-Jun-15 13:19 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc18-Jun-15 14:35
satc18-Jun-15 14:35 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Dave Kreskowiak18-Jun-15 15:33
mveDave Kreskowiak18-Jun-15 15:33 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc18-Jun-15 17:04
satc18-Jun-15 17:04 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Dave Kreskowiak18-Jun-15 18:24
mveDave Kreskowiak18-Jun-15 18:24 
satc wrote:
You are taking a case that has a low probability to happen.


HA HA HA HA HA !!! You haven't been doing this for very long, have you? It WILL bite you in the ass! The second you say it's "rare" for that to happen, it'll happen within 10 minutes of you deploying your code to production.

Also, "rare" is not "cannot ever happen". It WILL happen and you WILL lose data when it does.

In my example, it doesn't have to be two people updating the same record within milliseconds of each other. Both users can retrieve the data, User B can update the record while User A stares at the ceiling tiles for 20 minutes before he decides to undo his last change. Guess what just happened! User A didn't retrieve the record again and didn't know that User B made a change!

How are you going to handle that? You WILL have to handle that situation.

satc wrote:
Do you know any company works like this ?


Yes! The problem is called "concurrency" and people who write code have to deal with it every single day. Read up on it here[^]. There are various modes in which collisions like this can occur and various solutions to the problem, each with their pros and cons. Your job is to map your business rules to the situation and choose an appropriate method to deal with the problem, given the down side to the chosen solution.

In the website that I'm working on right now, we use two rules depending on the situation. We use either "last write wins" for data that isn't sensitive to changes of state and "optimistic concurrency" with the stuff that must maintain a consistent state across all involved fields. The later rule covering about 90% of our data.


satc wrote:
just like in the Word


You absolutely can NOT compare Word to a multi-user database scenario. The problems are very different, with document editing being very easy to back out. The reason for this is because the code maintains the state of the data (Word document) completely on its own WITHOUT ANY OUTSIDE ALTERATIONS to the data being possible because only one person can edit the document at a time.

Any data in a database can be changed by anyone at any time. Your code on one workstation will not know a change was made by another workstation.

Database changes cannot be backed out so easily without very careful consideration of the different possibilities where changes are being made and accounting for every single one of them in your code. You immediately failed at this requirement the second you dismissed even one possibility as a "rare" occurrence.

Make no mistake. What you want to do is not simple. In fact, it's quite a large project in itself and many things to consider and design for, even the stuff that has only, say, a 1 millisecond window of opportunity to happen.

satc wrote:
Instead of loosing time to this discussion , have someone an idea how can this be realized ?


You've already been told what you have to do and the possible pitfalls of various methods. The discussion of what you have to account for in your design and how to account for various things (given your business rules) will be a VERY long conversation and one that I doubt anyone is willing to take on in a forum environment.
A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc18-Jun-15 19:52
satc18-Jun-15 19:52 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Dave Kreskowiak19-Jun-15 2:32
mveDave Kreskowiak19-Jun-15 2:32 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc19-Jun-15 11:23
satc19-Jun-15 11:23 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Dave Kreskowiak19-Jun-15 12:45
mveDave Kreskowiak19-Jun-15 12:45 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc19-Jun-15 15:03
satc19-Jun-15 15:03 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Eddy Vluggen19-Jun-15 5:22
professionalEddy Vluggen19-Jun-15 5:22 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc19-Jun-15 11:27
satc19-Jun-15 11:27 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Eddy Vluggen19-Jun-15 11:40
professionalEddy Vluggen19-Jun-15 11:40 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc19-Jun-15 14:56
satc19-Jun-15 14:56 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
Eddy Vluggen19-Jun-15 23:32
professionalEddy Vluggen19-Jun-15 23:32 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
PIEBALDconsult18-Jun-15 18:44
mvePIEBALDconsult18-Jun-15 18:44 
GeneralRe: Mimic a Undo/Redo on a VB.net + Database application Pin
satc18-Jun-15 19:55
satc18-Jun-15 19:55 
QuestionRefresh a bindingsource Pin
satc17-Jun-15 17:02
satc17-Jun-15 17:02 
AnswerRe: Refresh a bindingsource Pin
Dave Kreskowiak17-Jun-15 18:52
mveDave Kreskowiak17-Jun-15 18:52 
GeneralRe: Refresh a bindingsource Pin
satc17-Jun-15 20:02
satc17-Jun-15 20:02 
GeneralRe: Refresh a bindingsource Pin
Dave Kreskowiak18-Jun-15 4:12
mveDave Kreskowiak18-Jun-15 4:12 
GeneralRe: Refresh a bindingsource Pin
satc18-Jun-15 10:14
satc18-Jun-15 10:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.