简体   繁体   English

如何在已发布的vb.net项目中包含SQLite数据库?

[英]How do I include my SQLite database in my published vb.net project?

I have been working on a project in vb.net which uses an SQLite database (Patient_Database.db). 我一直在vb.net中使用SQLite数据库(Patient_Database.db)的项目中工作。 The connection between the software and the database works when I debug the program, and the database is stored in the project folder, and automatically transferred to the debug folder, as shown: 当我调试程序时,软件和数据库之间的连接有效,并且数据库存储在项目文件夹中,并自动传输到调试文件夹,如下所示:

解决方案资源管理器中的数据库

调试文件夹中的数据库

However, when I publish the project in order to make an executable, the database is not included in the publication. 但是,当我发布项目以使其成为可执行文件时,数据库不包含在发布中。 I have spent all day trying various walkthroughs online but I just don't seem to be able to get the publication to include the database or the necessary SQLite.Interop.dll file in the x64 and x86 folders in the Debug folder. 我已经花了一整天的时间在线尝试各种演练,但是似乎无法使出版物在Debug文件夹的x64和x86文件夹中包含数据库或必要的SQLite.Interop.dll文件。

My published project looks like this: 我发布的项目如下所示:

出版物

With the following inside the Application Files folder: 在“应用程序文件”文件夹中包含以下内容:

在此处输入图片说明

I realise that I might be doing something stupid, or that I might just be going about this in the entirely incorrect way. 我意识到我可能正在做一些愚蠢的事情,或者我可能只是以完全错误的方式来做这件事。 If anyone could correct my flawed methods that would be very helpful! 如果有人可以纠正我有缺陷的方法,那将非常有帮助!

Thanks 谢谢

In regards to the comments some visual help for you: 关于评论,为您提供一些视觉帮助:

将数据库添加到已发布文件1

  1. Open project properties of your main project 打开主项目的项目属性
  2. Select the Publish tab 选择Publish选项卡
  3. Choose Application files... 选择Application files...

将数据库添加到已发布文件2

  1. Find your db file 查找您的数据库文件
  2. If it is not listed, select Show all files first 如果未列出,请选择Show all filesShow all files
  3. Set the Publish Status to Include 将发布状态设置为Include
  4. The Download Group should be Required . 下载组应该是Required

After a new publish the DB file should be contained in the Application Files on your server. 新发布后,数据库文件应包含在服务器上的Application Files

EDIT: To make the file visible for the published application files you have to set its 'Build Action': 编辑:要使文件对于已发布的应用程序文件可见,您必须设置其“生成操作”:

使DB文件可用于发布

在此处输入图片说明 Just add a folder "Database" in your project and insert there your file.db 只需在项目中添加一个文件夹“ Database”,然后在其中插入file.db

Then on Publish "Application files" include as dataFile your file.db 然后在发布“应用程序文件”中将您的file.db包含为dataFile

在此处输入图片说明

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将.mdf数据库连接到vb.net? - How can i connect my .mdf database into vb.net? 如何在项目中使用使用sqlite创建的数据库? - How do i use the database created using sqlite in my project? 如何使用访问数据库VB.net 2010保存我在datagridview中添加的列 - How to save the columns which i added in my datagridview using access database VB.net 2010 我想在VB.net中更新我的数据库数据,但出现错误语法 - I want to update my data of my database in VB.net but I get Error Syntax vb.net 如何在我的表单中添加一个值编号,并在我的数据库中添加一个值编号并更新为新数据 - vb.net how to add a value number in my form with a value number in my database and update as a new data VB.NET-我的SQLinsert有什么问题? 访问数据库 - VB.NET - What is wrong with my SQLinsert? Access database 我正在尝试在 vb.net 中创建一个下一个按钮来浏览我的访问数据库 - I am trying to create a next button in vb.net to navigate through my access database 如何用本地数据库发布vb.net项目 - How publish vb.net project with local database 如何在 Visual Studio 2010 的数据库中包含图像 - How do I include Images in my Database in Visual Studio 2010 如何在Eclipse中检查我的SQLite数据库值? - How do i check my SQLite database values in eclipse?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM