SQL Server Compact 和 SQL Server Compact单击一次&多个用户
我正在创建一个 clickonce 应用程序并计划使用 SQL Compact。但是,多个用户将在同一台计算机上使用该应用程序。他们是否可以共享同一个数据库?如果没有,我应该使用 Express 吗?
I am creating a clickonce app and planning on using SQL Compact. However, multiple users will be using the app on the same machine. Is this going to be possible for them to share the same database. If not, should I be using Express instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题实际上在于将数据库文件复制到每个人都可以从自己的帐户访问的地方。 ClickOnce 应用程序不以任何权限运行,因此我认为它们无法访问位于 c:\ourdatabase 中的数据库。
如果我是你,我会将应用程序部署到我的计算机上的本地主机,并将数据库复制到我想要的位置。该应用程序应指向该位置。以userA登录并运行看看能否成功访问数据库。对于用户 B 来说也是如此。
现在,如果可行,您可以尝试添加代码,以便在应用程序第一次在该计算机上运行时将数据库复制到该文件夹。只要检查一下文件夹和文件夹里的文件,如果没有就复制到那里。同样,您必须尝试一下,看看它是否有效。
The problem is actually about copying the database file somewhere everyone can get to it from their own account. ClickOnce apps don't run with any privileges, so I don't think they would be able to access the database if it was, say, in c:\ourdatabase.
If I were you, I would deploy the app to localhost on my machine, and copy the database to where I would want it to be. The app should point to that location. Log in as userA and run it and see if it can access the database successfully. Same for userB.
Now, if that works, you can try adding code to copy the database to that folder the very first time the application is run on that machine. Just check for the folder and the file in the folder, and if not there, copy it over there. Again, you'll have to try this out and see if it will work.