1

我正在从具有 bool 类型的列的数据库表中读取数据。我正在使用 Windows Phone 8 的 Sqlite 库。

这是我正在使用的代码

quotes = new ObservableCollection<Quotes>(
            await connection.QueryAsync<Quotes>("Select * from Quotes where quote_type ='" + category + "'"));

这是我的报价课

public class Quotes
{
    public int _id { get; set; }
    public string quote { get; set; }
    public string quote_type { get; set; }
    public string author { get; set; }
    public bool IsFav { get; set; }
    public bool IsUserDefined { get; set; }
}

我得到了所有的值,但“IsFav”和“IsUserDefined”变量始终包含值“False”,即使表中有一些数据的值为真。表中的变量和列名也匹配。

4

1 回答 1

0

设法让它工作。

将存储在 Sqlite db 布尔列中的数据更改为 0 和 1,而不是 true 和 false。

于 2013-09-23T18:15:02.583 回答