Re: Optimistic Concurrency - how? - net 2.0

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Sorry for the confusion. SQL Server guarantees transactional
consistency (a la the ACID test). By default if a row has been changed
since it was fetched, then SQLS will not allow a blind update (which
is what the DataAdapter handles). In a disconnected architecture such
as ADO.NET, special care needs to be taken to ensure that concurrency
violations, blocking and deadlocking do not occur. The best medicine
is always preventive medicine. If your table architecture is such that
no two users edit the same record at the same time, then there is
never a problem. By the same token, if the E-R design is a mess, then
you have a lot more work to do. Implementing explicit transactions
does lock resources until all units of work are complete, but so do
implicit (autocommit) transactions. Explicit transactions also
guarantee that you (the developer) always control the outcome. They
are the most efficient way of updating data as long as you keep them
short - no user interaction, execute on the server, return
success/failure information to the client so that client code can
branch accordingly.

-Mary

On Thu, 3 May 2007 15:08:01 -0700, Kerry Moorman
<KerryMoorman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Mary,

I'm confused by your reply.

How does SQL Server implement optimistic concurrency in a way that helps
with the disconnected architecture of ADO.Net?

How does normalization prevent 2 users from editing the same row at the same
time?

As for explicit transactions, isn't that pessimistic concurrency?

Kerry Moorman

"Mary Chipman [MSFT]" wrote:

One reason you don't see msdn content on this subject is because most
databases, such as SQL Server, implement optimistic concurrency by
default. One way to avoid concurrency violations is to normalize your
database schema so that no two users ever edit the same row at the
same time. Combining a sound ER design with explicit transactions
pretty much eliminates the problem. Custom solutions to fix
concurrency after the fact get complicated and expensive, as Bill
pointed out.

-Mary

On Thu, 3 May 2007 01:01:41 +0200, "Rolf Welskes" <rolf@xxxxxxxxxxxxx>
wrote:

Hello,
I have the situation that many users on the same db , table have access and
make changes.

Ok for this there is optimistic concurrency.

So I am able to check for cocurrency and get (in the moment) a messagebox,
which says
that there is a concurrency violation.

I have searched in MSDN and have many books about ado net 2.0,
but how to work REALY with optimistic concurrency no one says,
only in msdn is a small article with the absolute minimum to know.

Means, I can check and see that a concurrency violation is present,
but what now.

The user gets a messagebox: Data are not saved - Error.
No normal user for example a book keeper knows what to do.

I do no know how to hande such situations in details,
for example show the data or give a hint to do what ever.

It would be very helpful to have some full working examples for
a database which implements optimistic concurrency.

If there is anything, please send me links to it.

Thank you for any help.
Rolf Welskes


.



Relevant Pages

  • Re: Optimistic Concurrency on UpdateCommand...
    ... > I have a dataset generated from a SQL server table using Visual Studio ... > 'System.Data.DBConcurrencyException: Concurrency violation: the ... > UpdateCommand ... > 'Optimistic Concurrency' option in the configure dataAdapter screen. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Optimistic Concurrency on UpdateCommand...
    ... You should be able to find the command texts in the properties of the ... > I have a dataset generated from a SQL server table using Visual Studio ... > 'System.Data.DBConcurrencyException: Concurrency violation: the ... > 'Optimistic Concurrency' option in the configure dataAdapter screen. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: ADO.NET Transaction
    ... The SqlBulkCopy class can take anything you can expose with a DataReader and send it to SQL Server in a single high-speed operation. ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... Client transactions put too much schema-dependent, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: ADO.NET Transaction
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... Is it always a bad reason to do client transactions? ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: ADO.NET Transaction
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... Client transactions put too much schema-dependent, ...
    (microsoft.public.dotnet.framework.adonet)