Results 1 to 5 of 5

Thread: Select query using mysql for searching

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Select query using mysql for searching

    Qt Code:
    1. void VistaMedia::search()
    2. {
    3. QString searchText=searchTextLineEdit->text();
    4. QSqlQuery query;
    5. query.prepare("SELECT * FROM mediadetails WHERE title LIKE %:title% ");
    6. query.bindValue(":title",searchText);
    7. query.exec();
    8. while(query.next())
    9. listWidget->addItem(query.value(1).toString());
    10. QSqlError e=query.lastError () ;
    11. QMessageBox::information(this,"problem",e.text());
    12. }
    To copy to clipboard, switch view to plain text mode 
    above function shows error message box as "syntax error near %" after calling. Help me to write the correct syntax or anyclues for searching using wildcards!!!!!!!!
    Last edited by marcel; 9th April 2008 at 07:59. Reason: missing [code] tags
    @shish

Similar Threads

  1. INSERT query with MySQL problem
    By timmyg in forum Qt Programming
    Replies: 10
    Last Post: 20th March 2008, 21:52
  2. Mysql query question
    By twells55555 in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2007, 23:41

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.