Access数据库中Microsoft JET Database Engine (0x80004005) Could not use ''; file already in use.的解决方法

Microsoft JET Database Engine (0x80004005) Could not use ''; file already in use.
Products:      CodeCharge, CodeCharge Studio
Areas:     ASP, ASP.NET(C#), IDE/GUI

Symptoms
When viewing the page in Live Page mode or when trying to view a page after publishing it to the web server, the web
browser displays any of the following errors:

    * Microsoft JET Database Engine (0x80004005) Could not use ''; file already in use.
    * Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Microsoft Access 97 Driver] Couldn't use '(unknown)'; file already in use.
    * Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data.
    * Operation must use an updateable query. (Microsoft JET Database Engine)

 



解决方案1:

这个错误通常发生在 Windows NT, Windows 2000 or Windows XP ,他有可能是由下面的一些原因导致:

1.用户没有足够的权限去(读、写)修改数据库文件

- the database file doesn't have sufficient security permissions or write permissions to be modified when updating data in it. The web browser is seen by the web server as a Internet User that has the server account IUSR. This user needs to have write permission to the database file and to the database folder.
Resolution
Follow these steps to resolve this issue:
1. Use Windows Explorer to find the folder on the disk, which contains the database file (.mdb). This is usually your project folder.
2. Right-click on the project folder and select Properties.
3. Uncheck the Read-only property.
4. Click on the Security tab in the properties window.
(Attention: If you don't see such tab (Windows XP), close the properties window, open any folder, select Tools -> Folder Options -> View, and uncheck the option Use simple file sharing.)
5. Click Add and find, then select the user IUSR_<COMPUTERNAME>.
6. Select the Write checkbox in the Allow; column to assign Write permissions to the IUSR account.

 

解决方案2:

在大多数情况下,导致这个问题的原因是web.config的配置 。参考以下的配置web.config,这个错误就解决了:

 

 

代码
< configuration >   
< system.web >   
< identity impersonate = " true "   />   
</ system.web >   
</ configuration >    
< configuration >
< system.web >
< identity impersonate = " true "   />
</ system.web >
</ configuration >  

 

解决方案3:

这个错误的出现是因为一些连接还是open的状态。一个连接处于open状态可能有两种情况:

1.你没有在你的代码里使用 conn.Close(); 去关闭它

2.可能是中间的页面直接将你的页面跳到其他页面了

查看你的数据库操作代码,看看连接(oledbconnection) 对象有没有及时关掉

还有其他相关的资源有没有及时释放掉,一般就是这个原因。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值