I am using the sqlite v3, i have the table which has some columns of data type ‘bit’. I have inserted some data in this table with value ‘true’ in bit columns, But the problem is that when i retrieve the data using C# code it always return the value ‘false’.
The same query and same database is working fine for my android application. But, when i retrieve these data from C# or windows, than it returns the unusual results.
Sqlite admin shows the correct result in query pane…..
I am using chrome browser….
My C# code is
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();
}
}
These columns are the bit datatype and ‘true’ values but returns false.
i have update the sql lite query and cast the bit columns into nvarchar, so it return me the string in ‘true’ or ‘false’ format