newbie question

  • Thread starter Thread starter ma
  • Start date Start date
M

ma

Hello,

I did some database programming in the past and I always used database
controls which were offered by VB to connect to a database (Access
database). One facility that offered by these controls and I like it most is
the record locking. By record locking, I mean the capacity of locking a
record so it is not edited by two or more user at the same time.

I found that this technology is no longer supported in .NET. Am I right?

If I am wrong, how can I use this control (or similar control) in C#?

If I am right, how I can develop an application that when a user is editing
a record prevents others from editing the same record?



Regards
 
Hello ma,
Hello,

I did some database programming in the past and I always used
database controls which were offered by VB to connect to a database
(Access database). One facility that offered by these controls and I
like it most is the record locking. By record locking, I mean the
capacity of locking a record so it is not edited by two or more user
at the same time.

I found that this technology is no longer supported in .NET. Am I
right?

Right... This has been removed because of scalibilty issues with direct locking.
If I am wrong, how can I use this control (or similar control) in C#?

You can still use the old controls through COM interop, but it's not reccommended.
If I am right, how I can develop an application that when a user is
editing a record prevents others from editing the same record?

It's not so much as preventing, but detecting the problem. If you add a TimeStamp
column to your table, or check all the original values of the row and the
one in the database upon update you can prevent users from overwriting eachothers
changes. These two scenario's are directly supported by the ADO.NET design
time tools. If you want to find out more, look in the MSDN Documentation
for optimisitc and pessimistic locking.

Jesse
 
Ma,
Yes, you can still lock rows on the server if that's what you really
need to do. However, as I describe in my book this can be problematic as it
might lock out other users for an indefinite period of time. There are ways
to manage "pessimistic" locks if you are careful. The technique uses a
Transaction instance with the IsolationLevel set to RepeatableRead.
Associated with a Command object, this locks the rowset returned by the
CommandText until you execute the Commit method of the Transaction instance.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
The latest is "Hitchhiker's Guide to Visual Studio and SQL Server (7th
Edition)" (Addison Wesley).

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
ma,

In my opinion is it the best book for Newbie's for ADONET and SQL Server I
have seen so far, it is not theoretical, but focused on practical use.

(I don't get any fee from Bill)

:-)

Cor
 
Thanks Cor.
I'll let your kids go now... ;)

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
Back
Top