0
我正在使用Windows Phone 8应用程序。我SQLite中插入的数据,现在,我通过使用此命令,因为它是在一个给定的教程从检索数据:如何修改从数据库检索数据的SQLite查询
("select * from Task").FirstOrDefault();
我可以理解,它只是给第一或默认的结果,因为.FirstOrDefault
,但我想获得所有数据。什么将是查询?我也试过("select * from Task").All()
,但它给出了一个错误。
下面是完整的代码:
/// Create the database connection.
dbConn = new SQLiteConnection(DB_PATH);
/// Create the table Task, if it doesn't exist.
dbConn.CreateTable<Task>();
/// Retrieve the task list from the database.
///
var existing = db.Query<Task>("select * from Task").FirstOrDefault();
if (existing != null)
{
block3.Text = existing.Title;
block4.Text = existing.Expense;
db.RunInTransaction(() =>
{
db.Update(existing);
});
}
请给我建议如何修改所有结果的查询。
我不确定你为什么直接写SQL,[请试试这个教程](http://developer.nokia.com/Community/Wiki/How_to_use_SQLite_in_Windows_Phone)。 –