python - How to display data from a database file onto pyqt so that the user can add/delete/edit the data? -


I have created a database file in SQL using SQL commands. I have also experimented with many foreign keys but I am not sure how this data should be displayed on Qt with Python? any idea? I would also like to be able to add / edit / delete user data

Since the question is one It's a bit broad and normal, please start by this, you will get a lot of help to get started. Once you know what you are working on, you can make your UTV ET QT Designer and add functions to your event but every time you edit the form in QT, be careful that All your added python code will be removed so I recommend you to MVC pattern for your project.

EDIT: To demonstrate this data, you can also have an essence of what is required: It is believed that qttable is your grid in your class

  Def fillQTable (self): #data = [('1', '2', '3', '4'), ('5', '6', '7', '8')] # Database Data = Is self .getData () rOWCOUNT = lEN (data) colCount = 4 self.qttable.setRowCount (rOWCOUNT) self.qttable.setColumnCount (colCount) self.qttabke.verticalHeader (). setVisible (false) self.qttabke.setHorizontalHeaderLabels (QString ("num1; nUM2; num3; num4") partition (. ",")) self.qttabke.horizontalHeader () setVisible (true) range (colCount) :. For self.qttable.horizontalHeaderItem (.setTextAlignment) (Qt. AlignLeft) i, call in enumerate (data): for calculation (line): item = QTableWidgetItem (col) sel F.qttabke.setItem (i, j, item) def connectionDB (auto): try: cnn = pyodbc.connect ("DRIVER = {Microsoft Access driver (* .mdb)} \ \ DBQ = Data.mdb" #You can get CNN = self.connectionDB () Cursor = cnn.cursor () cursor: getdata (self) def print e: db library you have used pyodbc # here i like to connect MS Access to DB exception except for CNA To return, you can use E. # DataTable Data.mdb rawData = cursor.fetchall () cnn.commit () cnn.close () Return raw data    < Execute a table in / code> ./ html>

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -