【发布时间】:2018-08-13 12:26:39
【问题描述】:
我的应用程序 iOS 部分的 Resources 文件夹中有一个 .sqlite 文件。我现在在 AppDelegate.cs 中有:
string dbname = "test.sqlite";
string folderPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Resources), "..", "Library");
string fullPath = Path.Combine(folderPath, dbname);
我的问题是,当我使用 sqlite-net-pcl 库加载 sqlite 文件时,它显示一个空数据库,尽管 sqlite 文件中有超过 10,000 行。我认为问题是我链接到错误的东西。
再一次,sqlite 文件位于 Resources 文件夹中。如何访问它的文件路径?
【问题讨论】:
-
您是在尝试获取只读 SQLite 连接还是读写连接?
-
只读连接。
标签: c# ios xamarin xamarin.forms