How notice user, that this record has change by another user?

  • Thread starter Thread starter mttc
  • Start date Start date
M

mttc

Under ADO.NET and SQL 2000

I build form that edit data, and i use with wizard to create Update query.


What happen in this situation?:


I read record into DataSet. The user 1 change value an field A in the
record.

Meanwhile, user 2 change and commit the same record in field B.

Now the first user makes commit.


I suppose that field B is become again as original value!


If it is correct, what method I got to resolve this problem?

How notice user, that this record has change by another user?
 
Welcome to "Concurrency Management"

The below situation can be rectified by doing two things

a) Updating only the columns that you changed.
b) Checking the value of each column before doing the update. i.e. If A's
value used to be 1, then at update check and see if the value is still 1 and
update it to the new value (say 2) only if this test passes.

You can do the above by looking at various versions of values in your
dataset.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik
 
Until now, I write Data App on Access97 that Automatically
Deal with "Concurrency Management", now my wondering
Is, how many lines I need to write an solution of this
Basically needs?
The Dataset not contain a basic support for this?
 
mttc,

I am not sure why you say Access 97 supported concurrency management, as a
matter of fact, Access 97 was never designed with concurrency in mind.

ADO.NET in the solution I told you will have maybe 2 pages of extra code
you'd have to write - agreed, but have you looked into the data form wizard?
That writes all that code for you; including concurrency management.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik
 
Hi Sahil Malik
matter of fact, Access 97 was never designed with concurrency in mind.

I try Access97 like this:
I create mdb with link to sql table. I open it twice (in one PC).
I start Edit in instance 1, and I leave it in Edit mode. I move to
Instance 2 and I change value on the same record. Now I move
again to instance 1, and I try commit change, this arise Dialog that
notice me that another user make change with this record!
I think that behavior is apply on 2 separate workstations.
That writes all that code for you; including concurrency management.

You sure that wizard deals with this? You mean in Typed DataSet?
Please give me more info about it. Where I can find it in the code that
Wizard make?
Thanks
 
Hmm .. didn't know about linked tables handling concurrency .. cool good to
know, I'll try that sometime. I was thinking more in a single access d/b
scenario.

Data Form Wizard is gotten by Right Click --> Add new item --> Data Form
Wizard.

It isn't the most flexible thing in the world, but it will generate reams of
code for you and yes it will handle concurrency.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik
 
sorry, all mistake!

VS Adapter wizaed make sql statment like this: AND (comment =
@Original_comment OR ...

to prevent concurrency.
 
Back
Top