Solved

Database Lockout

Posted on 1998-10-04
5
224 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Title # Comments Views Activity
Get filename and folder into excel 7 79
iSeries FTP Exit Program 8 145
Smart Camera scanning and reading information 3 113
wait notify demo infinite loop 3 121
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

790 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