Results 1 to 1 of 1

Thread: Select statemen with bindvalues in Firebird 2 doesn't work

  1. #1
    Join Date
    Jul 2010
    Posts
    37
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Question Select statemen with bindvalues in Firebird 2 doesn't work

    How can i prepare sql SELECT statement using bindvalues ?
    Database is firebird 2.1. , QT 4.6

    an example with named placeholders:
    Qt Code:
    1. QString sql;
    2. sql.append("SELECT * FROM NEW_TABLE WHERE DATEBIRTH = :date_param AND NAME = :name_param");
    3. QSqlQuery query(DB);
    4. query.bindValue(":date_param",QDateTime::currentDateTime());
    5. query.bindValue(":name_param",QString("SMITH"));
    6. if (!query.prepare(sql))
    7. // ERROR: Dynamic SQL Error - SQL error code = -206 - Column unknown - DATE_PARAM - At line 1, column 44 Could not prepare statement
    To copy to clipboard, switch view to plain text mode 

    It does not work.


    I wonder: why bind values doesn't works with SELECT statemen?
    Is it a trouble of IBASE driver?

    I think that the driver should known its data types and substitute them with the appropriate type conversion into sql prepared statement: why it force me to rewrite the query statement like: QString(" WHERE DATE = '10/10/1980' and name = 'SMITH' ") ?


    thanks
    Last edited by corrado1972; 1st September 2010 at 16:35.

Similar Threads

  1. Example in Qt labs doesn't work
    By matko in forum Newbie
    Replies: 1
    Last Post: 19th November 2009, 18:59
  2. QNetworkAccessManager doesn't work
    By Floppy in forum Newbie
    Replies: 7
    Last Post: 14th November 2009, 16:32
  3. macdeployqt doesn't work at all.
    By pherthyl in forum Installation and Deployment
    Replies: 1
    Last Post: 10th July 2009, 00:42
  4. Q_PROPERTY: the example doesn't work!
    By YaK in forum Qt Programming
    Replies: 3
    Last Post: 7th July 2009, 11:28
  5. QRegExp doesn't seem to work as it should
    By thomaspu in forum Qt Programming
    Replies: 3
    Last Post: 21st December 2007, 07:49

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.