<Unable to read data> on BOOLEAN field

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
kelian
Posts: 1
Joined: Tue 01 Nov 2016 14:43

<Unable to read data> on BOOLEAN field

Post by kelian » Tue 01 Nov 2016 15:47

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

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: <Unable to read data> on BOOLEAN field

Post by Pinturiccio » Fri 04 Nov 2016 12:17

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();

Post Reply