Results 1 to 2 of 2

Thread: list tables column name (database)

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default list tables column name (database)

    I am very new to database . I use QSqlDatabase to connect to a database ( access, MySQL,SQL) , I want to get all the tables in a database and all the column names under that table.

    Now, I am wondering , given QSqlDatabase and QSqlQuery , can I get the column names of each tables? I can easily get the tables list in that database thru QSqlDatabase::tables() but the columns (column names) under each table is my problem.

    Please help,

    baray98

  2. #2
    Join Date
    Sep 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: list tables column name (database)

    QSqlDatabase db;
    ...
    QSqlRecord record=db.record("mytable");

    see QSqlRecord documentation for more details

Similar Threads

  1. How to get list of database's table's foreign keys?
    By jambrek in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2008, 05:50
  2. Multiple database connections
    By cyberboy in forum Qt Programming
    Replies: 3
    Last Post: 30th March 2008, 16:56
  3. Replies: 0
    Last Post: 10th November 2006, 13:46
  4. Filling combobox from database
    By Philip_Anselmo in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2006, 17:53
  5. hidden QListView column suddenly visible
    By edb in forum Qt Programming
    Replies: 10
    Last Post: 27th January 2006, 08:00

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.