使用 Sqlite DB 部署 VB.Net Winforms 应用程序
好的...VB6 时代我们可以在应用程序目录中创建一个文件夹(数据)并将我们的数据库粘贴到其中(c:\program files\myApplication\Data\MyAppData.s3db)的日子已经一去不复返了。我不想将 vb.net 与 Sql Server 一起使用!在.Net 中,我知道特殊文件夹和用户应用程序数据文件夹。如果我将这种类型的文件夹添加到我的包和部署项目中,并包含作为空白数据库的文件,则将创建该文件夹,并且数据库不会位于其中。如果我使用应用程序数据文件夹,我会失去写入能力,因为文件夹和所有子文件都是只读的。我被困住了。我无法在代码中的 C:\Program Files (x 86) 中创建新文件夹,然后通过为每个表运行创建表查询从头开始创建数据库。什么样的应用程序部署才是好的?似乎没有人能回答这个问题。任何帮助将不胜感激。
Ok... Gone are the VB6 days where we could create a folder (data) in the application directory and stick our database in there (c:\program files\myApplication\Data\MyAppData.s3db). I don't want to use vb.net with Sql Server! In .Net I am aware of the special folders and the the User Application Data folders. If I add that type of folder to my package and deployment project and include the file that is our blank database, the folder will be created and the db will not be in there. If I use the Application Data folders I loose the write ability as the folders and all sub files are readonly. I'm stuck. I can't create a new folder in the C:\Program Files (x 86)in code and then create the db from scratch through running create table queries for each table. What would be good application deployment? No one seems to have an answer for this one. Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个只读的所有用户应用程序数据文件夹和每个用户的单独的应用程序数据文件夹。每用户应用程序数据文件夹不是只读 - 您可以对其进行写入。
我通常所做的是将一个空白数据文件部署到我的 Program Files 文件夹中,并在用户第一次运行我的应用程序时将此文件复制到用户的 App Data 文件夹中。
There is an All Users Application Data folder that is readonly and a separate Application Data folder for each user. The per-user Application Data folders are not readonly — you can write to them.
What I normally do is deploy a blank data file to my Program Files folder, and copy this file to the user's App Data folder when the user runs my app for the first time.
全局应用程序数据文件夹对于非管理员用户是只读的。但每个用户都有自己的应用程序数据文件夹,您绝对可以写入该文件夹,并且它是存储特定于应用程序的数据的首选位置。不幸的是,这些文件夹默认是隐藏的。
The global Application Data folder is read-only for non-admin users. But every user has their own Application Data folder which you can definitely write to and is the preferred place for storing application-specific data. Unfortunately, these folders are hidden by default.