Solved

ADO - SQL Sever

Posted on 2001-08-01
5
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 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…

749 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