Solved

ADO - SQL Sever

Posted on 2001-08-01
5
179 Views
Last Modified: 2013-11-23
Why do we need ADO locking if SQL Server uses its own locking system
0
Comment
Question by:Morphism
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:nigelrowe
ID: 6339637
It is wise to leave locking to SQL Server, it automatically calculates the locking level which should be used. You can use ADO sql execution to force a particular type of lock, but you'd better be careful.
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6339745
ADO locking is there to provide you with feedback on the locking state in a multi-user system. If you use adLockOptimistic for every transaction then you may encounter problems updating a record that is locked by another user. adLockPessimistic raises an error if you attempt this and you can then deal with the failed update, retry or abandon it. SQL Server on its own will not do this for you unless you build it into the stored procedures that you call using ADO. In many ways this is a better option, that is using stored procedures and building in verification of updates/inserts and recovery. This would allow your application to run in the same manner using any data access technology.
0
 

Author Comment

by:Morphism
ID: 6348295
so I should really use stored procs instead of ADO executes or ADO Recorsets?
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6348634
If you are designing an application in a multi-tier structure then the database layer should be independent of the data access layer, in a SQL server implementation this means effectively that you design it using stored procedures and call these procedures from your data access layer. This has many benefits; you stored procedures can be easily modified without having to make code changes, you can secure the tables/views so that users cannot make changes to the data without using the stored procedures - this provides a consistent data manipulation strategy, the execution plan for a compiled stored procedure is already determined by sql server and therefore doesn't need to be determined for each statement executed on the client, if you develop for multiple user interfaces/data access technologies again you are guaranteed a consistent data manipulation regardless of the front-end.

I am a big fan of using stored procedures in this way, whilst it can add a bit of time at the beginning it is a much more controllable and effective way of developing an application (IMHO).
0
 

Author Comment

by:Morphism
ID: 6358632
how do you mean the database layer should be independent
of the dataaccess layer
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now