Python Forum
[PyQt] [Solved]Help displaying SQLite Database
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] [Solved]Help displaying SQLite Database
#3
I tried adding WHERE type = table to my SELECT statement to be more specific but I get the same error.

My table is populated so I don't know what you mean by
Quote:Your database has no table items.
could you please clarify what you mean by that?

Here's the table (called items) that was created:
import sqlite3

def createDatabase():
        #Create a database (inventory.db)
        connection = sqlite3.connect("inventory.db")
        cursor = connection.cursor()

        table = """CREATE TABLE IF NOT EXISTS items
                (ID INTEGER PRIMARY KEY  AUTOINCREMENT,
                NAME           TEXT    NOT NULL,
                Quantity       INT     NOT NULL,
                Price          DOUBLE  NOT NULL,
                Sell_Price     DOUBLE,
                Description    TEXT,
                Category       TEXT,
                Location       TEXT    NOT NULL,
                Length_Ft      INT,
                Barcode        INT,
                Image          BLOB,
                Date Updated   datetime default current_timestamp);"""

        #Execute the creation of the table
        cursor.execute(table)
        #print("The database has been created")
        #Commit the changes
        connection.commit()
        #Close the connection
        connection.close() 
Reply


Messages In This Thread
[Solved]Help displaying SQLite Database - by Extra - May-19-2022, 01:19 AM
RE: Help displaying SQLite Database - by Extra - May-19-2022, 11:34 PM
RE: Help displaying SQLite Database - by Extra - May-20-2022, 11:24 PM
RE: Help displaying SQLite Database - by Larz60+ - May-20-2022, 12:09 PM
RE: Help displaying SQLite Database - by Extra - May-21-2022, 08:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PyQt5 form not displaying my data from SQLite3 Database Linuxdesire 2 5,050 Jan-10-2023, 09:51 PM
Last Post: gradlon93
  [PyQt] [Solved]Help displaying a table with QSqlTableModel Extra 10 2,939 Jun-29-2022, 10:18 PM
Last Post: Extra
  Displaying database info in QTableWidget thewolf 6 5,439 Apr-03-2021, 02:49 PM
Last Post: thewolf
  [Tkinter] Displaying Data from a database and run a function when clicked? PythonNPC 1 2,101 Mar-11-2020, 08:16 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020