SQL精简版3.5 - 访问数据库文件是不允许的 [英] SQL Compact Edition 3.5 - Access to the database file is not allowed
问题描述
我开发的应用程序(100%地方,没有对服务器的访问)使用的SQL Server Compact 3.5 的,它的工作原理罚款我的电脑上。然而,当我部署在另一台计算机上,它显示了这个错误:
I developed an application (100% local, no access to servers) using SQL Server Compact 3.5, and it works fine on my computer. However, when I deployed it on another computer, it shows this error:
Access to the database file is not allowed. [ File name = data\BDApepucCE.sdf ]
我部署了Windows XP计算机上。它显示了这个错误,每当我尝试在数据库上写的,但是,它的工作原理,当我读
I deployed on a Windows XP computer. It shows this error whenever I try to write on the database, however, it works when I read.
我做了一个Windows 7的计算机上的测试,和它的工作100 %,除了当该文件是通过家庭组访问(即,本地网络),在其上失败的两个读/写
I did a test on a Windows 7 computer, and it worked 100%, except when the file was accessed through the homegroup (that is, local network), on which it failed on both read/write.
平台:Windows 7中,视觉Studio 2010中,并 .NET 4客户端配置文件
Platform: Windows 7, Visual Studio 2010, and .NET 4 Client Profile
推荐答案
请确保您使用 | DataDirectory目录|
您的连接的字符串中。
下面是一个例子。
Make sure you use |DataDirectory|
in your connection string.
Here is an example
connectionString="Data Source=|DataDirectory|MyDB.sdf"
我有完全相同的问题,唉,你和我设法通过增加解决它| DataDirectory目录|我的连接字符串。
I had the exact same problem ay you and I managed to fix it by adding the |DataDirectory| to my connection string.
祝你好运。
这篇关于SQL精简版3.5 - 访问数据库文件是不允许的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!