Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 4th, 2003, 04:09 AM
Registered User
 
Join Date: Jun 2003
Location: Ashford, Kent, United Kingdom.
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
Reply With Quote
  #2 (permalink)  
Old June 4th, 2003, 07:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
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
Reply With Quote
  #3 (permalink)  
Old June 5th, 2003, 06:36 AM
Registered User
 
Join Date: Jun 2003
Location: Ashford, Kent, United Kingdom.
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
Reply With Quote
  #4 (permalink)  
Old June 5th, 2003, 07:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.