简体   繁体   English

如果我使用 SQLite 创建 C# 桌面应用程序,数据库是否会与安装程序捆绑在一起?

[英]If I create a C# desktop application with SQLite, will the database get bundled with the installer?

I am trying to make an application for managing a small store, which will be offline.我正在尝试制作一个用于管理小型商店的应用程序,该商店将脱机。 I am considering using SQLite for my data handling needs.我正在考虑使用 SQLite 来满足我的数据处理需求。 Once I create the installer for this project, does the database get attached to the installer or will have have to take additional steps to make the application work.一旦我为这个项目创建了安装程序,数据库是否会附加到安装程序,或者必须采取额外的步骤来使应用程序工作。

Also is SQLite the best way to approach this or should I consider something else? SQLite 是解决这个问题的最佳方法还是我应该考虑其他方法?

Since SQLite needs a file to work with you can include a file which contains empty schema of your SQLite database in your setup project and copy it to working directory.由于 SQLite 需要一个文件才能使用,因此您可以在安装项目中包含一个包含 SQLite 数据库空架构的文件,并将其复制到工作目录。 Or add your empty db file as a resource to your application.或者将您的空 db 文件作为资源添加到您的应用程序中。 And in your connection string builder/provider check existence of the file if it doesn't exists read it from resource and copy to the target location.并在您的连接字符串构建器/提供程序中检查文件是否存在,如果它不存在,则从资源中读取它并复制到目标位置。 And also SQLite is good option for that kind of usage. SQLite 也是这种用法的不错选择。

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

相关问题 如何使用SQLite数据库为AC#应用程序发布/创建安装程序? - How To Publish/Create Installer For A C# Application With An SQLite Database? 图像无法使用C#Desktop Application保存SQLite数据库 - Image not saving SQLite Database with C# Desktop Application 如何创建 C# 桌面应用程序设置文件以及数据库 - How to create C# desktop application setup file along with database 我需要将.mdb数据库附加到C#桌面应用程序 - I need to attach .mdb database to C# desktop application 如何在C#中为桌面应用程序创建activeX组件 - How do I create an activeX component for a desktop application in C# 如何为 C# windows 应用程序创建安装程序并集成 SQL 服务器数据库 - How to create a installer for C# windows application with SQL Server database integrated C#中用于桌面应用程序的数据库引擎 - Database engine for a desktop application in C# 如何为C#桌面应用程序创建exe - how to create exe for c# desktop application 为C#应用程序创建安装程序时要使用的数据库 - Database to use when creating an installer for your c# application 编写需要嵌入加密数据库的C#桌面应用程序。我应该使用什么类型的数据库? - Writing a C# desktop application that needs to embed an encrypted database. What type of database should I use?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM