如何在 .NET DLL 中嵌入 SQLite 数据库,然后从 C# 中使用它? [英] How can I embed a SQLite Database in a .NET DLL and then use it from C#?

查看:21
本文介绍了如何在 .NET DLL 中嵌入 SQLite 数据库,然后从 C# 中使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我正在规划的项目进行一些评估工作.

I'm currently working on some evaluation work for a project that I'm planning.

我最近为我的应用程序研究了数据存储机制的解决方案,并在研究时偶然发现了 SQLite.我目前将 SQLite 与 System.Data.SQLite 包装器一起使用.

I recently looked at solutions for a data storage mechanism for my application and while researching stumbled upon SQLite. I currently use SQLite with the System.Data.SQLite wrapper.

我真的很喜欢它的工作方式,但我有一个无法解决的问题,而且我在互联网上也没有找到有关我的问题的帮助.

I really like the way it works but I have one problem with it that I couldn't get fixed and I also found no help concerning my problem on the internet.

我希望将我的 SQLite 数据库嵌入到我的应用程序 DLL 之一(即 Title.Storage.dll)中,以便在该 DLL 中使用.这可能吗?

I would like my SQLite Database to be embedded into one of my applications DLLs (ie. Title.Storage.dll) to be used within this DLL. Is this possible?

那我怎样才能访问数据库呢?

How can I access the database then?

如果我可以使用类似的东西就好了:

It would be great if I could use something like:

SQLiteConnection con = new SQLiteConnection();
con.ConnectionString="DataSource=Title.Storage.storage.db3";
con.Open();

提前致谢并致以最诚挚的问候,

Thanks in advance and best regards,

3Fox

推荐答案

程序集不是用于文件存储,而是用于代码存储.虽然您可以将文件存储在程序集中,但它们是只读的.

An assembly isn't for file storage, it's for code storage. While you can store files in an assembly, they are read only.

这篇关于如何在 .NET DLL 中嵌入 SQLite 数据库,然后从 C# 中使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆