SQLite Forum

GetDataTypeName broken?
Login
First Create a database with:

CREATE TABLE test(
a INTEGER)


then execute the following c# code:

using System;
using System.Data.SQLite;

namespace SQLiteDataTypeTest
{
    class Program
    {
        static void Main(string[] args)
        {
            SQLiteConnection Connection = new SQLiteConnection(@"Data Source=<THE_DATABASE>;");
            Connection.Open();
            
            var sqlCommand = Connection.CreateCommand();
            var sqlQuery = "pragma table_info(test)";

            sqlCommand.CommandText = sqlQuery;

            var reader = sqlCommand.ExecuteReader();

            Console.WriteLine("Column name = " + reader.GetName(5)); //PK column
            Console.WriteLine("Datatype = " + reader.GetDataTypeName(5)); //PK column
            Console.ReadKey();
            reader.Close();
            Connection.Close();
        }
    }
}




This will result in the output:
Column name = pk
Datatype =


Datatype should here be integer since that's the column it's type.