i really do not know what would be the best way to prevent two user to access same data from sql server. i have developed a win apps using c# where user click on record to modify it. when user click on records then a new form is shown with data from where user can modify the data. suppose my application is running on two pc and two user open the same record then who update the same data last that will be saved in db.
so what i did...i create a table and store record id in that table whenever any user open data record.if a record id is stored in table so next time another user can not access that data rather get message who is working on this records. this way my purpose is solved but i do not know whether it is right or best approach or not.
so guys tell me how to handle this situation with best approach. thanks