Multiuser database access

  • Thread starter Thread starter cj
  • Start date Start date
C

cj

The program I just finished allows users to pull a set of records from
sql server and edit them. It is meant to be a one user system but it
makes me start thinking. Suppose two users use the program at the same
time. Both get the same starting set of data. Both users change the
same records but not the same way and they both save. I assume the last
one to save is the way the record will end up in sql server. Suppose
that is not correct. What do we do to ensure the second user gets an
error that that record has changed since they loaded it? Is there
record locking etc available in VB? How do programmers deal with this
these days?
 
cj said:
The program I just finished allows users to pull a set of records
from sql server and edit them. It is meant to be a one user system
but it makes me start thinking. Suppose two users use the program
at the same time. Both get the same starting set of data. Both
users change the same records but not the same way and they both
save. I assume the last one to save is the way the record will end
up in sql server. Suppose that is not correct. What do we do to
ensure the second user gets an error that that record has changed
since they loaded it? Is there record locking etc available in VB?
How do programmers deal with this these days?


http://msdn2.microsoft.com/en-us/library/aa0416cz(VS.90).aspx



Armin
 
Finally an article in MSDN I understand, although I think I'll have to
try a few things when I get back to the office next week.

Now this covered optimistic concurrency. Can we do pessimistic
concurrency in VB? Do you have a link to that?
 
cj said:
Finally an article in MSDN I understand, although I think I'll have
to try a few things when I get back to the office next week.

Now this covered optimistic concurrency. Can we do pessimistic
concurrency in VB? Do you have a link to that?


No, can't provide a link. I'd ask in the ADO.Net group:
microsoft.public.dotnet.framework.adonet

A cross-language question, IMO.


Armin
 
Hello cj,

Pessimistic locking is not natively supported in ADO.NET. However, we can
achieve this type of locking through transactions. The following article is
a sample about it.
http://articles.techrepublic.com.com/5100-22-1049842.html
[Pessimistic locking solves ADO.NET concurrency problems]

Hope this helps. If there is anything unclear, feel free to update here
again. We are glad to assist you.

Have a great day,

Best regards,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top