?
Solved

C# and MS Access problem

Posted on 2014-01-07
5
Medium Priority
?
202 Views
Last Modified: 2014-04-14
Hi

I am developing a c# 2010 winforms application connecting to a networked MS Access 2003 database.

Occasionally I am seeing a message

"the database has been placed in a state by user 'admin' on machine 'ABCD'"

this doesn't happen too often and when it does, if I close the application and re-open it, it usually works ok.


The database is password protected and to my knowledge, I am the only person who knows it... the error appears when I have not got access open... so I can't see why there is a lock going on?  None of the code allows users to modify the database structure, only the contents...

What should I look for?
0
Comment
Question by:cycledude
[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 7

Expert Comment

by:Kishan Zunjare
ID: 39764749
It sounds like Access thinks something in the database is open in design mode.  it must be something outside the database in the registry.
0
 
LVL 85
ID: 39764817
This can occur due to a "hanging lock file". When an access database is opened by any method (including your C# program), Access creates a "lock file", generally in the same directory where the database file is located. That file is named the same as the database, but with a .ldb (2003 or older) or .accdb (2007 or newer) extension. Sometimes that lockfile is not removed when the database is closed, and the next time it's opened Access will think someone else has the file open, and you can receive that message.

Be sure that you always properly close all connections to the database, and be sure users have read/write/create/delete permissions on the folder hosting that database.

Your database may also be corrupt. The easiest way to fix that is to create a new, blank database in Microsoft Access and import everything into that new database. Depending on your version of Access, the steps to do that are different, so if you're not clear on how to do that post back and we'll give you further guidance.
0
 

Author Comment

by:cycledude
ID: 39764847
Thanks for the comments

I do try to be vigilant about closing the datareader after accessing the database, I may have missed one or 2 connections, can't be sure... but I had issues in the past where I hadn't close the datareader and it threw odd application errors, so since then I have tried to ensure the database datareader is closed...
0
 

Accepted Solution

by:
cycledude earned 0 total points
ID: 39882376
there is a potential solution to this which I got from the microsoft website,

http://support.microsoft.com/kb/274211

I have applied some changes to my code to reduce the number of times the database is opened and closed... hope fully this will resolve the issues...
0
 

Author Closing Comment

by:cycledude
ID: 39998513
the problem appears to have ceased since implementing this solution.
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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses

762 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