Improve company productivity with a Business Account.Sign Up

x
?
Solved

ADO - SQL Sever

Posted on 2001-08-01
5
Medium Priority
?
211 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 200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

595 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