我正在使用sqlite v3,我有表中有一些数据类型为'bit'的列。我已经在这个表中插入了一些数据,在位列中的值为'true',但问题是,当我使用C#代码检索数据时,它总是返回值'false'。sqlite位列在每种情况下都返回'false'值
相同的查询和相同的数据库工作正常我的android应用程序。但是,当我从C#或窗口中检索这些数据时,它会返回不寻常的结果。
sqlite的管理员显示正确结果查询窗格..... 我使用Chrome浏览器.... 我的C#代码是
SQLiteConnection sqlite_connection =null;
if(isTrans)
sqlite_connection = sqliteTrans.Connection;
else
sqlite_connection = this.ConnectionInstance;
try
{
SQLiteCommand sqlite_command = new SQLiteCommand("SELECT AdditionalServices, VitalObservation from tblReadonlyPatientData where SubscriptionID = 1306", sqlite_connection);
SQLiteDataReader reader = sqlite_command.ExecuteReader();
StringBuilder queryToExecute = new StringBuilder();
while (reader.Read())
{
queryToExecute.Append(reader.GetString(0));
}
// always call Close when done reading.
reader.Close();
reader = null;
sqlite_command = null
}
catch (Exception e)
{
clsException.ExceptionInstance.HandleException(e);
throw;
}
finally
{
if (!isTrans && sqlite_connection != null)
{
if (sqlite_connection.State == System.Data.ConnectionState.Open)
sqlite_connection.Close();
}
}
这些列是bit数据类型和“真”值,但返回false。
你可以添加1-用一些样本记录位列中的确切值,以及2- C#代码用于检索数据? – 2012-04-25 10:15:23
我已更新问题........ – Talha 2012-04-25 10:48:33
哪一列_exactly_具有“位”类型,您将在哪里使用它,并获得意外的结果? – 2012-04-25 11:35:37