Results 1 to 5 of 5

Thread: Select query using mysql for searching

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    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

    Unhappy Re: Select query using mysql for searching

    void VistaMedia::search()
    {
    QString searchText=searchTextLineEdit->text();
    QSqlQuery query;
    query.prepare("SELECT title FROM mediadetails WHERE title LIKE ' %:title% '"); query.bindValue(":title",searchText);
    query.exec();
    while(query.next())
    listWidget->addItem(query.value(0).toString());
    QSqlError e=query.lastError () ;
    QMessageBox::information(this,"problem",e.text());
    }



    table details are as :
    mediadetails
    ----------------
    |title|

    F_1.avi
    F_2.avi
    11.dat
    music.dat
    jazz.avi

    i am entering in the search text " f ".

    thanks for the suggesstions ....but even after doing so....there is a new error message shows "unable to fetch data". what to do????
    Last edited by sinha.ashish; 10th April 2008 at 05:37.
    @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
  •  
Qt is a trademark of The Qt Company.