Results 1 to 1 of 1

Thread: unable to insert into table

  1. #1
    Join Date
    Oct 2009
    Location
    chennai,india
    Posts
    66
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default unable to insert into table

    hi all
    im trying to insert a value into the table
    Qt Code:
    1. QSqlDatabase db1=QSqlDatabase::database("con");
    2.  
    3. if(db1.open())
    4. {
    5. qDebug() << "database opened ";
    6. QSqlQuery query;
    7. query.prepare("insert into waitrequest (bednumber)""values(:bednumber)");
    8. query.bindValue(":bednumber",10001);
    9. query.exec();
    10. db1.close();
    11. }
    To copy to clipboard, switch view to plain text mode 
    but it did not insert the record rather, it shows an error,
    QSqlQuery:: prepare: database not open.
    i checked the connection ,and it is present!!
    can any one help me ??
    thanks and regards
    Last edited by mohanakrishnan; 4th December 2009 at 10:55. Reason: small mistake

Similar Threads

  1. Replies: 0
    Last Post: 4th December 2008, 05:48
  2. Postgresql QSqlRelationalTableModel empty table
    By RolandHughes in forum Qt Programming
    Replies: 0
    Last Post: 12th November 2008, 17:18
  3. Replies: 3
    Last Post: 5th October 2008, 23:41
  4. How to Compile VTKDesigner2 with Qt?
    By alfredoaal in forum Newbie
    Replies: 0
    Last Post: 5th September 2008, 05:34
  5. 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.