Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. System.Data.SQLite.SQLiteException: 'SQL logic error no such table: Incident'

System.Data.SQLite.SQLiteException: 'SQL logic error no such table: Incident'

Scheduled Pinned Locked Moved C#
databasehelpsqliteannouncement
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_16121942
    wrote on last edited by
    #1

    I'm trying to populate a combobox with a column in a SQLite database table. Im using an Absolute path in my connection string but Im getting an Error that the table doesn't exist. Ive read through other posts and still cant resolve the problem. Here is my code.

    public Form1()
    {
    InitializeComponent();

    if (File.Exists(@"R:\\TEOP\\Tracker\\Tracker.db"))
    {
        SQLiteConnection conn;
        conn = new SQLiteConnection("Data Source=R:\\\\TEOP\\\\Tracker\\\\Tracker.db,version=3;");
        conn.Open();
        SQLiteCommand cmd;
        cmd = conn.CreateCommand();
        cmd.CommandText = @"SELECT IncidentName FROM Incident;";
        
        var dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            IncidentCombo.Items.Add(dr\["IncidentName"\]);
        }
        
    }
    

    }

    Ive checked permissions and path. My query works in the database browser.

    D T 2 Replies Last reply
    0
    • M Member_16121942

      I'm trying to populate a combobox with a column in a SQLite database table. Im using an Absolute path in my connection string but Im getting an Error that the table doesn't exist. Ive read through other posts and still cant resolve the problem. Here is my code.

      public Form1()
      {
      InitializeComponent();

      if (File.Exists(@"R:\\TEOP\\Tracker\\Tracker.db"))
      {
          SQLiteConnection conn;
          conn = new SQLiteConnection("Data Source=R:\\\\TEOP\\\\Tracker\\\\Tracker.db,version=3;");
          conn.Open();
          SQLiteCommand cmd;
          cmd = conn.CreateCommand();
          cmd.CommandText = @"SELECT IncidentName FROM Incident;";
          
          var dr = cmd.ExecuteReader();
          while (dr.Read())
          {
              IncidentCombo.Items.Add(dr\["IncidentName"\]);
          }
          
      }
      

      }

      Ive checked permissions and path. My query works in the database browser.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      In problem posts like this, always copy'n'paste the exact error message. If the message indeed says your table doesn't exist, it has nothing to do with the connection string. It's telling you don't have a table called 'Incident' in your database. Check the spelling of the table name in your query and carefully compare to the table name in the database.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

      1 Reply Last reply
      0
      • M Member_16121942

        I'm trying to populate a combobox with a column in a SQLite database table. Im using an Absolute path in my connection string but Im getting an Error that the table doesn't exist. Ive read through other posts and still cant resolve the problem. Here is my code.

        public Form1()
        {
        InitializeComponent();

        if (File.Exists(@"R:\\TEOP\\Tracker\\Tracker.db"))
        {
            SQLiteConnection conn;
            conn = new SQLiteConnection("Data Source=R:\\\\TEOP\\\\Tracker\\\\Tracker.db,version=3;");
            conn.Open();
            SQLiteCommand cmd;
            cmd = conn.CreateCommand();
            cmd.CommandText = @"SELECT IncidentName FROM Incident;";
            
            var dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                IncidentCombo.Items.Add(dr\["IncidentName"\]);
            }
            
        }
        

        }

        Ive checked permissions and path. My query works in the database browser.

        T Offline
        T Offline
        tronderen
        wrote on last edited by
        #3

        NOTE: DISCLAIMER: I have no experience with SQLite! This is just a shot in the dark from an ignorant non-expert: I tried to look up examples of SQL use, and saw them use a semicolon rather than a comma before 'version=3;' I also saw that opening a non-existing database will created one by the given name. So, if the entire string 'R:\\TEOP\\Tracker\\Tracker.db,version=3' is take as a database name, then you are opening a new, empty database, which obviously doesn't have an 'Incident' table. (I must admit that I am surprised if a database can be named R:\\TEOP\\Tracker\\Tracker.db,version=3, so this may be a completely wrong track to follow!)

        M D 2 Replies Last reply
        0
        • T tronderen

          NOTE: DISCLAIMER: I have no experience with SQLite! This is just a shot in the dark from an ignorant non-expert: I tried to look up examples of SQL use, and saw them use a semicolon rather than a comma before 'version=3;' I also saw that opening a non-existing database will created one by the given name. So, if the entire string 'R:\\TEOP\\Tracker\\Tracker.db,version=3' is take as a database name, then you are opening a new, empty database, which obviously doesn't have an 'Incident' table. (I must admit that I am surprised if a database can be named R:\\TEOP\\Tracker\\Tracker.db,version=3, so this may be a completely wrong track to follow!)

          M Offline
          M Offline
          Member_16121942
          wrote on last edited by
          #4

          Thank you that was the problem ....A typing error replacing the "," with a ";" was the problem. Syntax is a killer at times!....lol

          1 Reply Last reply
          0
          • T tronderen

            NOTE: DISCLAIMER: I have no experience with SQLite! This is just a shot in the dark from an ignorant non-expert: I tried to look up examples of SQL use, and saw them use a semicolon rather than a comma before 'version=3;' I also saw that opening a non-existing database will created one by the given name. So, if the entire string 'R:\\TEOP\\Tracker\\Tracker.db,version=3' is take as a database name, then you are opening a new, empty database, which obviously doesn't have an 'Incident' table. (I must admit that I am surprised if a database can be named R:\\TEOP\\Tracker\\Tracker.db,version=3, so this may be a completely wrong track to follow!)

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            Nice catch. I missed that one.

            Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups