Groups | Blog | Home
all groups > dotnet odbc.net > january 2004 >

dotnet odbc.net : Do i need to lock the table if i want to do an update?



babylon
1/9/2004 12:30:12 PM
e.g.
if i wanna do retrive a row from a table and increment one of the column of
that row by 1
do i need to
lock table
do a "select" to get the row
update the row/table
unlock table?

thx....

HussAb NO[at]SPAM online.microsoft.com
1/10/2004 2:23:42 AM
A plain Select query will not put a lock on the table, however a
Delete/Insert/Update commands will put a lock either on a row level, a page
level or a table level according to the locking mechanism used. Through
Transactions, you specify the lock level according to some lock hints. You
may want to consult with your database documentation and read more about
Transactions and how to specify what locking level you want.

Doing Updates using ADO.NET and transactions will help you specifying an
"Isolation level" that you want. The SDK documentation has plenty of
information on this topic (just search for "Isolation level").

I hope this helps!

Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
AddThis Social Bookmark Button