Solved

use of adLockPessimistic

Posted on 2004-04-06
7
644 Views
Last Modified: 2011-09-20
Hi,

I am getting the following problem .

Maximum locks exceeded per file.Increase the Locks per file.

I am trying with the following code.

Set rstemp = New ADODB.Recordset
rstemp.Open sCond, adoConAccess, adOpenStatic, adLockPessimistic

is there any effect of using adlockpessimistic ?
Any disadvantages of using   adlockpessimistic instead of adlockoptimistic


Pls let me know ..

Thanks,
Siva.
0
Comment
Question by:sivavb
7 Comments
 
LVL 15

Expert Comment

by:unknown_routine
ID: 10768416
I  had the same problem but reading following link helped me to fix it.


Basically you need to avoid using adLockPessimistic, but if you have to updare the records as soon as possible.

Look here: It is a golden link.

http://www.vbmysql.com/articles/cursorsandlocks.html

it talked about mysql database , but these concepts are exactly same for SQL sever and MS access.

0
 
LVL 29

Expert Comment

by:leonstryker
ID: 10768427
The message has nothing to do with the type of lock you are using. adLockPessimistic and others specify as to how the database records are locked once the data is accessed.  Your problem seems to be with a number of locks.

Leon
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 10768440
Are you using an Access database? Is the file stored on a Novell file server?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Accepted Solution

by:
SSSoftware earned 25 total points
ID: 10768464
Lock Pessamastic - Locks the record when it is read for update
Lock Optamistic - locks the record when it is updated

If there is only one user of the database then Optomistic is OK
If there is more than one user then you have to be able to handle the situation that :

1 ) the record may be locked by a second user when tou go to update it.
2) the record may have changed between the time you read the record and you are now rewriting it.

additionally,

Depending on the database
    - If you are using commitment control then all records that have been read remain locked until a "Commmit" or a "Rollback" is issured.

Good luck,
Ed
0
 

Author Comment

by:sivavb
ID: 10768518
Hi Leon,

Thanks for the info..
U are right ..the prob is with the no.of locks..
Can u let me know what is the solution for this..

Thanks,
Siva
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 10768595


It seems to be a known issue identified by microsoft.


Here is how to fix the problem:

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B815281



0
 
LVL 29

Expert Comment

by:leonstryker
ID: 10768613
Looks like unknown_routine got what you need. Give it a try :)

Leon
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

713 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