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
#9
try this

    def loaddata(self):
        connection = sqlite3.connect("inventory.db")
        cursor = connection.cursor()
        cursor.execute('select * from items')
        row = 0
        self.InventoryDisplay.setRowCount(40)
        while True:
            form = cursor.fetchone()
            if form == None:
                break
            for column, item in enumerate(form):
                self.InventoryDisplay.setItem(row, column, QTableWidgetItem(str(item)))
                print(str(item))
            row += 1
        connection.close()
        #---------------------------------------------------------------------
        
        self.retranslateUi(self)
        QMetaObject.connectSlotsByName(self)
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 Axel_Erfurt - May-21-2022, 09:03 AM
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,049 Jan-10-2023, 09:51 PM
Last Post: gradlon93
  [PyQt] [Solved]Help displaying a table with QSqlTableModel Extra 10 2,938 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,100 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