Solved

Database Lockout

Posted on 1998-10-04
5
235 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
[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
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

631 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