473,322 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Database concurrency control question

Hi .NET experts,

I was a 2 tier database programmer using delphi. In Delphi, if user A is
writting a record, this record is locked from user B for writting. If user A
insert a new record, when user B moves cursor in datagrid, the new record
will be reflected in the applicatoin.

In ADO.NET, we use a 3-tier like logic. Dataset is the middle tier to me.
After data is filled in dataset, dataset is not aware of the change in SQL
Server. So when user A edits a new record in his dataset in his local
machine, user B might be doing the same thing. When they update SQL Server,
no gurrentee the accuracy. When User A creates a record and insert it in SQL
server, user B is not aware about it. He might be doing the samething. So it
might end up with the duplicate record information.
Even with the connected layer of ADO.NET, it does not have real time
concurrecny control like I had in old delphi 2 tier system.

I am new to C#. So I might miss some wonderful features of .NET. Could
someone tell me how to get the real time concurrency control in .NET like I
had before in delphi?

Thanks,

Karl
Nov 16 '05 #1
3 2088
Karl... If the application is over a stateless protocol such as the
Internet, the
default is to use optimistic concurrency. The .NET dataset uses
optimistic
concurrency logic ALL for concurrency control. Alternatively, you can
use a
timestamp on the row and check to see if the timestamp has been updated
between the client read and client attempt to write to a row.

http://www.geocities.com/jeff_louie/net_update.htm

Regards,
Jeff
I am new to C#. So I might miss some wonderful features of .NET. Could

someone tell me how to get the real time concurrency control in .NET
like I
had before in delphi?<
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #2
Hmmm. If you want to implement pessimistic concurrency you can roll your
own by adding a timestamp and userid column. Define a time out and
update
the timestamp and userid. You application will need to see if the userid
has
timed out before "locking" the row. The client will need to persist the
userid.
There is nothing stopping another application from ignoring the "lock."

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3
Karl,

What you describe can be done with simple text "Record locking"

This is done since the first databases, although it has some advantages has
it as well a lot of disadvantages.

Here a page about that. (In case of bank terminals and things like that it
is in my opinion still the best way before you understand me wrong, however
not forever).

http://msdn.microsoft.com/library/de...cyChecking.asp

I hope this gives some idea's

Cor
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

49
by: Relaxin | last post by:
It is just me or has MS created some of the worst ways to access and display data? You can use a DataSet, but if you want to sort or filter the data to must use a DataView which is created from...
2
by: xAvailx | last post by:
I have a requirement that requires detection of rows deleted/updated by other processes. My business objects call stored procedures to create, read, update, delete data in a SQL Server 2000 data...
7
by: chessplayer | last post by:
Greetings Folks, I am trying to understand how DB2 locks data and can't believe my eyes. Have read the literature about the difference isolation levels and have a general understanding about...
6
by: Frank Rizzo | last post by:
Hello, I am writing a server that will be inserting/reading/updating the database on multiple threads. I understand that you can't have more than 1 reader open on a database connection. Are...
5
by: John Rivers | last post by:
Hello, The common approaches to concurrency control in web apps: optimistic: - row version (timestamp, guid, datetime, digest) etc. - value checking pessimistic: - locking fields /...
3
by: punt | last post by:
At Uni last year we created a VS.NET application which connected to access database on a single machine, with a full install program. My question is does this system work well for a networked...
5
by: Vayse | last post by:
In my save code, most of items save fine. But sometimes I get a concurrency violation message. "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." It happens on the...
9
by: corey.coughlin | last post by:
Alright, so I've been following some of the arguments about enhancing parallelism in python, and I've kind of been struck by how hard things still are. It seems like what we really need is a more...
0
by: RKT | last post by:
I have a DataGridView bound to an MS Access table. This is a single- user application. When the User is adding or editing a row, the User may click on a Control elsewhere. That Control has context...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.