Re: How to connect Access database .mdb under windows XP
From: cschang (cschang_at_maxinter.net)
Date: 12/02/04
- Next message: Yalaman: "Reg- Dynamic tab strip and Multipage"
- Previous message: endingman: "how to :"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Yalaman: "Reg- Dynamic tab strip and Multipage"
- Previous message: endingman: "how to :"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|