Optimistic concurrency

H

HG

Hi group.

Hope there are some gurus out there that can help me understand this topic.

I am about to design a rather large department solution in .NET, utilizing
ADO.NET, ASP.NET and XML WebServices.

How do ADO.NET handle optimistic concurrency? From what I have read it is
built in. But only if you use the CommandBuilder or construct your UPDATE
stament/prodcedure so, that every column is checked against, right?
I am having trouble finding out on what level the concurrency check is done.

This is the "architecture" I plan to use:

WebForm->DataBound component->DataSet->DataAdapter->DataSource

I understand that if I only use one table, the CommandBuilder can be used to
build select, update, delete and insert statements of the DataAdapter. On
update all colums are checking against in the WHERE clause, to check if some
of them have changed since the DataSet was filled by the DataAdapter. In
this scenario it seems like the concurrency is handled at the database
level.
When not using the CommandBuilder, do I have to provide a "similar mecanism"
myself, when writing the code for select, update, delete and insert
statements?

Sorry for the rather long post...But I hope someone has just a bit of the
answers to my quesions..

Thanx in advance

Best regards

Henrik
 
M

Miha Markic [MVP C#]

Hi,

HG said:
Hi group.

Hope there are some gurus out there that can help me understand this topic.

I am about to design a rather large department solution in .NET, utilizing
ADO.NET, ASP.NET and XML WebServices.

How do ADO.NET handle optimistic concurrency? From what I have read it is
built in. But only if you use the CommandBuilder or construct your UPDATE
stament/prodcedure so, that every column is checked against, right?
I am having trouble finding out on what level the concurrency check is done.

This is the "architecture" I plan to use:

WebForm->DataBound component->DataSet->DataAdapter->DataSource

I understand that if I only use one table, the CommandBuilder can be used to
build select, update, delete and insert statements of the DataAdapter. On
update all colums are checking against in the WHERE clause, to check if some
of them have changed since the DataSet was filled by the DataAdapter. In
this scenario it seems like the concurrency is handled at the database
level.
When not using the CommandBuilder, do I have to provide a "similar mecanism"
myself, when writing the code for select, update, delete and insert
statements?

ADO.NET has support for optimistic concurrency in the sense, that it checks
how many rows were affected during insert, update or delete when working
with DataAdapter.Update method.
And this feature relies on proper WHERE clause (check either each field or
just a timestamp).
So yes, you have to provide a proper SQL statemtent.
Sorry for the rather long post...But I hope someone has just a bit of the
answers to my quesions..

No problem.
 
H

HG

Hi Miha
ADO.NET has support for optimistic concurrency in the sense, that it checks
how many rows were affected during insert, update or delete when working
with DataAdapter.Update method.
And this feature relies on proper WHERE clause (check either each field or
just a timestamp).
So yes, you have to provide a proper SQL statemtent.

Thanx for the answer.
As far as I can see, the various database wizards in VS .NET 2003 takes care
of this plumbing, also when you do stored procedures.

I think I have read somewhere in the patterns and design series, that the
preferred way to handle CRUD staments for DataAdapters is through SPs... Is
that right?

Regards

Henrik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top