Results 1 to 3 of 3

Thread: How do I create a new table using QSQL mods

  1. #1
    Join Date
    Nov 2006
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default How do I create a new table using QSQL mods

    Tried this but does not work

    QString cmd = "CREATE TABLE example(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), age INT)";
    QSqlQuery query;
    query.exec(cmd);

    qDebug() << query.lastError();
    reports: QSqlError(-1, """", """")
    Last edited by Harvey West; 14th December 2006 at 19:04. Reason: Fingers

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How do I create a new table using QSQL mods

    What do you mean by "does not work"? Do you connect to the database? Does this statement work, if you execute it from the SQL console?

  3. #3
    Join Date
    Nov 2006
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How do I create a new table using QSQL mods

    No worries - Typo - works now.
    Was on the right path which is nice to know. Cheers.

Similar Threads

  1. displaying any table on a qdatatable
    By Philip_Anselmo in forum Newbie
    Replies: 4
    Last Post: 9th May 2006, 22:12
  2. creating table plugin
    By mgurbuz in forum Qt Programming
    Replies: 3
    Last Post: 28th April 2006, 13:50

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.