troubleshooting Question

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

Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America asked on
DatabasesC#Windows OSSQL
7 Comments1 Solution130 ViewsLast Modified:
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
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros