“操作必须使用可更新的查询”。部署后 [英] "operation must use an updateable query" after deployment
问题描述
我已经使用Access 2010数据库在C#(WPF)中创建了桌面应用程序,还为它创建了安装程序。我的问题是,当我将其安装在PC上时,它可以正常工作,但是当我将其安装在其他PC上时,它将失败,并显示
I have created a desktop application in C# (WPF) with an Access 2010 database, I have also created setup program for it. My problem is that when I installed it on my PC it works fine, but when I install it on some other PC then it fails with an Exception like
一个可更新的查询。
我已经搜索了它,发现的每个答案都表明这是一个权限问题。我试图完全访问数据库文件夹,但仍然遇到相同的错误,最近两天我都试图解决它,但仍然没有找到解决方法。
I have searched for it and every answer I found suggested that it was a permissions issue. I have tried to give full access to database folder but still I get the same error, I have tried to resolve it for last two days but I still haven't found a solution.
推荐答案
如果安装程序将数据库文件与可执行文件放在同一文件夹中,例如 C:CProgram Files\myApp \
,那么普通用户将仅具有对数据库的只读访问权限:
If your installer is placing the database file in the same folder as the executable file(s), e.g., C:\Program Files\myApp\
then regular users will only have read-only access to the database:
即使您的安装程序修改了数据库 file 的权限, ,普通用户仍将具有对数据库的只读访问权限,因为他们在文件夹 ...
Even if your installer modifies the permissions on the database file, regular users will still have read-only access to the database because they have read-only access on the folder...
...而您绝对不会希望对常规用户
对该文件夹打开读写访问权限。 (有关文件/文件夹权限对Jet / ACE数据库的影响的详细信息,请参阅我的回答在这里。)
...and you definitely do NOT want to open up read-write access on that folder to regular Users
. (For details on the effect of file/folder permissions on Jet/ACE databases, see my answer here.)
相反,您的安装程序应该将数据库文件放在普通用户通常具有读写访问权限的文件夹中,也许在%PUBLIC%
下。
Instead, your installer should be putting the database file into a folder where regular users normally have read-write access, perhaps somewhere under %PUBLIC%
.
这篇关于“操作必须使用可更新的查询”。部署后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!