Page 1 of 1

<Unable to read data> on BOOLEAN field

Posted: Tue 01 Nov 2016 15:47
by kelian
Both the last version and the latest version give me a value of <Unable to read data> in a Boolean field when querying through Visual Studio 2015 via Server Explorer.

It also throws an exception in code with the message 'String was not recognized as a valid Boolean.'. The dynamic type shows as object{long} and the value as 11.

Per the TableDDL, the column is defined as '[Enabled] BOOLEAN DEFAULT True,'.

Here is the example code I used:

Code: Select all

using System;
using Devart.Data.SQLite;

namespace devartSQLite
{
	class Program
	{
		static void Main(string[] args)
		{
			using (var connection = new SQLiteConnection())
			{
				try
				{
					connection.ConnectionString = @"Data Source=C:\CMUD\Arctic\Arctic.dbm;FailIfMissing=False";

					connection.Open();

					using (var command = connection.CreateCommand())
					{
						command.CommandText = "SELECT * FROM [ObjectTbl]";
						using (var reader = command.ExecuteReader())
						{
							// printing the column names
							for (int i = 0; i < reader.FieldCount; i++)
							{
								var value = reader.GetName(i);

								Console.Write($"{value.ToString()}\t");
							}
							Console.Write(Environment.NewLine);
							// Always call Read before accesing data
							while (reader.Read())
							{
								// printing the table content
								for (int i = 0; i < reader.FieldCount; i++)
								{
									try
									{
										var value = reader.GetValue(i);

										Console.Write($"{value.ToString()}\t");
									}
									catch
									{
										Console.Write("<Unable to read data>");
									}
								}
								Console.Write(Environment.NewLine);
							}
						}
					}
				}
				finally
				{
					if ((default(SQLiteConnection) != connection) && (!String.IsNullOrEmpty(connection.ServerVersion)))
					{
						connection.Close();
					}
				}
			}
			Console.Write("\n\nPress Any Key to Continue...");
			var wait = Console.ReadKey();
		}
	}
}
Thanks,

--Patrick

Re: <Unable to read data> on BOOLEAN field

Posted: Fri 04 Nov 2016 12:17
by Pinturiccio
We could not reproduce the issue with the latest dotConnect for SQLite version. Please send us your database file.

Please also tell us sqlite3.dll version in your application. It can be found with the following code:

Code: Select all

SQLiteConnection conn = new SQLiteConnection(@"Data Source=C:\CMUD\Arctic\Arctic.dbm;FailIfMissing=False");
conn.Open();
Console.WriteLine(conn.ServerVersion);
conn.Close();