如何计算 SQLite.Net 和 Xamarin.Forms 中的行数?
How to count rows in SQLite.Net and Xamarin.Forms?
我已经在 SQLite.Net 数据库中存储了工作正常的字符串数量,我可以从数据库访问数据。当我尝试使用 CountAsync 方法计算行数时,它不会 return 数据并立即跳过所有要执行的代码并转到 return 语句。我也尝试过使用断点,但是模块中不可用的框架出现了,当我继续执行到另一个断点时,它再次 returns。
我插入数据如下
List<string> places = this.ParseGetNewPlacesSoapResponse(soapResponse);
var insertDB = DependencyService.Get<IDBPath>().GetDBPath();
await insertDB.CreateTableAsync<tempPlaces>();
await insertDB.InsertAllAsync(places);
行数统计代码
var db = DependencyService.Get<IDBPath>().GetDBPath();
await db.CreateTableAsync<tempPlaces>();
var rows = await db.Table<tempPlaces>().CountAsync();
我无法找出它不起作用的原因。当我用 android 模拟器尝试它时,它总是继续执行代码,甚至没有调试。
我找到了解决方案,在 PCL 项目中,我正在使用依赖服务,所以我将我的链接器设置更改为 link none,现在它工作正常。
我已经在 SQLite.Net 数据库中存储了工作正常的字符串数量,我可以从数据库访问数据。当我尝试使用 CountAsync 方法计算行数时,它不会 return 数据并立即跳过所有要执行的代码并转到 return 语句。我也尝试过使用断点,但是模块中不可用的框架出现了,当我继续执行到另一个断点时,它再次 returns。
我插入数据如下
List<string> places = this.ParseGetNewPlacesSoapResponse(soapResponse);
var insertDB = DependencyService.Get<IDBPath>().GetDBPath();
await insertDB.CreateTableAsync<tempPlaces>();
await insertDB.InsertAllAsync(places);
行数统计代码
var db = DependencyService.Get<IDBPath>().GetDBPath();
await db.CreateTableAsync<tempPlaces>();
var rows = await db.Table<tempPlaces>().CountAsync();
我无法找出它不起作用的原因。当我用 android 模拟器尝试它时,它总是继续执行代码,甚至没有调试。
我找到了解决方案,在 PCL 项目中,我正在使用依赖服务,所以我将我的链接器设置更改为 link none,现在它工作正常。