Results 1 to 4 of 4

Thread: How to get data from mysql ?

  1. #1
    Join Date
    Aug 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How to get data from mysql ?

    Hi guys
    I have a question. How to get data from mysql and how this data write to QTableWidget ?
    Thanks*
    Last edited by BuranereLoo; 3rd September 2015 at 10:51.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,418
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to get data from mysql ?

    For example with QSqlQueryModel.

    Cheers,
    _

  3. #3
    Join Date
    Aug 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: How to get data from mysql ?

    Can you give an example?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,418
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to get data from mysql ?

    First you create a database connection
    http://doc.qt.io/qt-5/qsqldatabase.html#details

    Then you use this to either create a QSqlQuery object and pass that to the model, or you pass the query and the connection to the model.
    The model can be set on a QTableView before that.

    Cheers,
    _

Similar Threads

  1. Connect to the MYSQL server successful but can't see any data
    By stereoMatching in forum Qt Programming
    Replies: 1
    Last Post: 9th January 2014, 04:06
  2. Visualising data from mysql table
    By vrltwe in forum Newbie
    Replies: 3
    Last Post: 30th December 2013, 17:14
  3. Qt MySQL big data insertion
    By ^NyAw^ in forum Qt Programming
    Replies: 4
    Last Post: 5th July 2013, 12:01
  4. Replies: 2
    Last Post: 3rd November 2012, 18:15
  5. Replies: 1
    Last Post: 21st March 2006, 12:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.