Solved

Database Lockout

Posted on 1998-10-04
5
221 Views
Last Modified: 2013-11-20
I am developing a database app using DAO classes. One of my views contains a spliiter window ala Windows explorer that displays information from a table in the righ hand pane. The information was retrieved using a SQL statement SELECT * from table. The other pane displays information from multiple tables using an SQL inner join statement. There is 1 table that is common for both views. These recordset objects are created in sepperate clases created using the RUNTIME (class,etc.. etc) statement in the OnCreatClient meber function of the child window conatianing this spitter view.  Now at last the problem. When I try to close the child window containing this view I get the error CANNOT LOCK TABLE "tablename". This is the table that is common to both classes. I have code in both classes descrutors to close the recordset set objects. Note I have only 1 databse object create in the App class. Both recordset objects are connected to this database object. Help?.
0
Comment
Question by:BlackRussian
  • 3
5 Comments
 
LVL 1

Expert Comment

by:VAM345
ID: 1322906
Pleace tell me hay you use CDaoRecordset::Open.

0
 
LVL 1

Expert Comment

by:VAM345
ID: 1322907
Pleace tell me hay you use CDaoRecordset::Open.

0
 

Author Comment

by:BlackRussian
ID: 1322908
Yes I use the CDaoRecordset::Open statment. In the OnCreate function of each class I use recordset = new CDaoRecordset (theApp.database); to connect the recordset object to the single global database object, I then use  recordset->Open(dbOpenSnapshot,SQLstmt); to create the recordset object.  
0
 
LVL 1

Expert Comment

by:VAM345
ID: 1322909
I my work I use recordet form one commont table in meny recordset and this work wor me.
Pleace tell me more of you SQL stmt? You problem mey be in other you code.
0
 
LVL 1

Accepted Solution

by:
Fargo earned 200 total points
ID: 1322910
Take a close look of the nOptions parameter of the CDaoRecorset::Open(...) function. There you can set the way the recordset co-works with the other recordsets, that have open the table. When you do changes to a record of a recordet, whenever an Update is called (which may happen when you close the recordset), DAO locks the table for writing, and if it's already locked by another recordset, this exception is thrown. You have to open one of your recordsets for read-only. This is done when you set the nOption parameter to dbReadOnly.
I'm not informed with the specification of your project, so I can't tell more, but if you read carefully what MSDN says about CDaoRecordet::Open(...), you may come to a conclusion.

Hope I was help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand macro to ask for filename column 8 37
Importing Special Characters in Dynamics GP Through Integration Manager 3 69
tripleUp challenge 7 74
NotAlone Challenge 20 80
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 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

16 Experts available now in Live!

Get 1:1 Help Now