0
public ObservableCollection<AppUser> AppUser { get; set; }

public AppUserDbConnect(string dbPath)
{
    _database = new SQLiteAsyncConnection(dbPath);
    _database.CreateTableAsync<AppUser>().Wait();
    this.AppUser = new ObservableCollection<AppUser>(_database.Table<AppUser>());
}

此代码创建一个数据库连接,然后基于AppUser模型创建一个表。我正在尝试存储最后一行的结果,但遇到以下错误:

CS1503 参数 1:无法从转换 Dialler1.DatabaseConnection.AsyncTableQuery<AppUser>System.Collections.Generic.IEnumerable<AppUser>

4

1 回答 1

0

调用ToList _db.Table<T>()

 this.AppUser = new ObservableCollection<AppUser>(_database.Table<AppUser>().ToList());
于 2018-01-30T08:29:38.427 回答