Click to See Complete Forum and Search --> : How to control any Concurrency problem?


soclose
September 4th, 2008, 06:50 AM
Hi, I created a MS SQL Server database. Three users will insert, update and delete... in same table of this database at the same time. I developed business application by VB.NET. But I don't know any way how to control any Concurrency problem. pls share me. thks

davide++
September 4th, 2008, 07:02 AM
Hi all.

I don't know SqlServer, but usually concurrency is straight managed by the db engine.
It's SqlServer that worries about data integrity in shared environment; it puts locks on tables during DML operations, so the changes can be made by only user at time.

soclose
September 4th, 2008, 11:05 PM
Hi davide++, is there another way besides locking? In other dbms, use locking?

Alsvha
September 5th, 2008, 09:18 AM
As davide++ states, it is usually a problem best left to the database engine. They handle it with what is call isolation level, and locking of rows.

I'm unsure about what your problem specifically is - when you mention "concurrency" it leads to that people write to the database at the same time, which is handled by the system itself.

But it could be - and I'm just guessing here - that you are more worried about "old/outdated" information overwriting new.
Something like:
User 1 fetches a row with Value1: "AA" and Value2: "BB"
User 2 fetches the same row.
User 1 alters Value1 to "CC" and saves.
User 2 alters Value2 to "DD" and saves.

The content in the database would now be Value1: "AA" and Value2: "DD", where as you might would have wanted it to be "CC" and "DD".

Is that your problem?