Re: How to connect Access database .mdb under windows XP

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: cschang (cschang_at_maxinter.net)
Date: 12/02/04


Date: Wed, 01 Dec 2004 22:00:28 -0500

Jos wrote:
> cschang wrote:
>
>>Jos Branders wrote:
>>
>>>cschang wrote:
>>>
>>>
>>>>I used the Data Form wizard of .NET to create a C# dataset form to
>>>>query the data from an Access database file "MWIND.MDB", but I kept
>>>>getting following message when I run the web form on XP only
>>>>"The Microsoft Jet database engine cannot open the file
>>>>'C:\mydb\NWIND.MDB'. It is already opened exclusively by another
>>>>user, or you need permission to view its data." I tried other
>>>>similar dataase file and it ws same result. It is OK under Windows
>>>>2000. I also tried by maually creating the connection string as
>>>>@"Provider=""Microsoft.Jet.OLEDB.4.0"";Data
>>>>Source=""C:\mydb\NWIND.MDB"";User ID=Admin;Password=;";
>>>>But I got the similar message anyway. Is there something in Access
>>>>ODBC needed to be changed? Thanks for any tip.
>>>>
>>>>Chi Chang
>>>
>>>
>>>I assume you're using the same location and the same web form
>>>under 2000 and XP.
>>>
>>>Check the security settings of your database file. It should
>>>at least have read access for the ASPNET user.
>>>
>>
>>Sorry, I don't quite get your points.
>>My NWIND.mdb is at different location of the the web form, which is
>>created under the C:\Inetpub\wwwroot\315C05. for both the Windows 2000
>>and XP.
>>
>>Secondly, myself has the administrator privilege under XP and I
>>checked the properties of the database file and there are only
>>general and summary tabs, no security. Am I missing something here
>>on my XP machine?
>
>
> Could it be that your database is open in Access while you are trying
> to access it from the web form?
>
> Another suggestion might be to wrap your code in an exception block.
> This ensures that the database is not locked when something goes wrong.
> dbConn = new OleDbConnection(strConn);
> try
> {
> dbConn.Open();
> // do your stuff here
> }
> catch (Exception ex)
> {
> dbConn.Close();
> }
>
>
I found the solution in another news group, VC#. Basically, under the
XP, you need to change the security of the file by assigning the ASP.net
user from the system to have the privilege to access the mdb file. That
is. And the reason I can't see the security tab under the XP is because
   by default the security tab is hidden. You can change it by go to
the window explore -> Tools -> folder option -> View -> Advance
Setting, uncheck the last check box about Simple File sharing. Then you
can see the security tab of the file. Going there add the ASP.NET user
and give it Full control (or Read, Modify.. ) try you self which is best
for your own good.

C Chang



Relevant Pages

  • Strange user granted rights: who/what is it?!
    ... ASP and was connecting to a database. ... It appears this user/group has access to every folder on my harddrive. ... Next to the name of this strange user/group in the security tab is a picture ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Lost Administrative Access to the SMS Admin Console
    ... Any kind of direct database manipulation is ... > When I check the Security tab I can see ... > that my original userID is listed as the Administrator. ... > Is there anyway to gain access to the SMS Admin console? ...
    (microsoft.public.sms.admin)
  • Re: .LDB file has no security tab
    ... Databases on a Windows 2003 Sever. ... This file is created to lock the database and keep other users ... That is the .LDB file auto-deletes and has a security tab. ...
    (microsoft.public.windows.server.general)
  • .LDB file has no security tab
    ... We are using Access 2003 from a Windows XP Pro workstation accessing Databases on a Windows 2003 Sever. ... This file is created to lock the database and keep other users from accessing it when someone is already using it. ... That is the .LDB file auto-deletes and has a security tab. ...
    (microsoft.public.windows.server.general)