Wrox Programmer Forums
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2003, 04:09 AM
Registered User
 
Join Date: Jun 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Locking

My understanding is that SQL2k handles locking automatically. Is that sufficient in real-world situations or do you use manual locking as the need arises? I am writing a fairly simple ASP/SQL database for < 10 users.

Peter Riley
 
Old June 4th, 2003, 07:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

SQL Server indeed handles locking automatically. I would guess that for 99.9% (or more!) of the cases this is sufficient. There are ways to tell the lock manager to handle locking differently than it otherwise might. See "locking, hints" in BOL.

Be careful if you use these hints that you know what you are doing. Frequently, you'll make things worse if you override the default behavior. You'll either adversely affect concurrency, or you'll return dirty data you might not really want.

Generally speaking, less than 10 users does not a concurrency problem make, so I would strongly recommend you leave things alone. Concentrate on getting the transactions right, and leave the locking to the system.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old June 5th, 2003, 06:36 AM
Registered User
 
Join Date: Jun 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Jeff. I was unsure because many of the code samples I have found include something like adLockReadOnly as part of the database connection. Maybe that's an Access thing though?

Peter Riley
 
Old June 5th, 2003, 07:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, 'adLockReadOnly' is a value for the ADO Recordset LockType property, which affects the behavior of the cursor (recordset) and is not, strictly speaking, a SQL Server thing (or an Access thing).

The various settings of this property affect how OLEDB handles recordset editing by establishing and/or maintaining locks (in the database) on recordset rows when the recordset is opened for editing.

I never use recordsets for editing, perferring instead to do all database access through stored procedures, so I never use any setting other than 'adLockReadOnly' which basically declares my recordset read-only, minimizing both client and server resources.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking Users Out ryandoah BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 June 26th, 2007 06:16 PM
Form Locking dancook Access VBA 2 November 7th, 2006 11:38 AM
Pessimistic locking SQLScott SQL Server 2005 1 September 14th, 2006 12:51 PM
Dll Locking mistry_bhavin General .NET 1 April 18th, 2005 08:45 AM
Database Locking royalsurej General .NET 2 November 9th, 2004 08:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.