Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSqlTableModel with custom sql queries



  • Hi,
    My application needs accessing two or more MySQL database tables, for reading and writing, with certain clauses. So I would like to know, how to do this? can I override SQL syntax for selecting and updating tables in QSqlTableModel?
    Thanking You,
    Ras



  • First see if QSqlRelationalTableModel scratches your itch. Alternatively write your own QSqlQueryModel subclass that allows editing (see the query model example for a basic version).

    You might also see if writing through a MySQL view is possible and, if so, can solve your problem.


Log in to reply