Hello ,

My application has an admin section which stores its password in web.config file. There can be case when simultaneosly 2 administrator logs in admin section and try to update the same database. I want to prevent this from happening. Can anyone suggest how to implement this. Update functionality runs via threading.

Regards,
Pradeep

use record locking

agree with jbennet

you can choose to create your own method of locking, or go by sql physical locking

not sure what db or version you are using, but the sql concepts are row lock or table lock

if you want to implement this yourself, you can add a locked column to the row and set to 1 or 0 depending upon its current state

table, record or database lock
depends on what DBMS you are using.
Record (row) is generally the best

If you are using a microsoft technology its dead easy to set up.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.