Avatar of Tom Knowlton
Tom Knowlton
Flag for United States of America

asked on 

System.Data.SQLite.SQLiteException: 'SQL logic error no such table: tags' - but the table does exist.

Using nuget package Sqlite in a C# Windows Forms App in VS 2019 Community Edition.

I get this runtime exception:

SQL logic error
no such table

The table does exist, and the path is correct in the Data Source connection string.  I can open the self same table in Sqlite's DB Browser utility and it's there and the same select statement as the one in the code snippet below works fine:

  public static List<object> GetAllTags()
            List<object> tempTagList = new List<object>();           

            string sql = "select tagname from tags order by tagname asc";
            SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
            SQLiteDataReader query = command.ExecuteReader();  ///////////////////////////////////////////// EXCEPTION GETS RAISED ON THIS LINE ////////////////////////////////////

            while (query.Read())
                string temp = query.GetString(0);


            return tempTagList;

Open in new window

NOTE:  Here is the connection string to the database:

 public static class DataHelper
        public static string DB_FILENAME = @"Data Source=C:\Users\ENDER\Desktop\DCT\DCT\bin\Debug\CBDB.db;";
        private static SQLiteConnection m_dbConnection = new SQLiteConnection(DB_FILENAME);




Open in new window

About SQL Lite
DatabasesC#Windows OSSQL

Avatar of undefined
Last Comment

8/22/2022 - Mon