void VistaMedia::search()
{
QString searchText
=searchTextLineEdit
->text
();
query.prepare("SELECT * FROM mediadetails WHERE title LIKE %:title% ");
query.bindValue(":title",searchText);
query.exec();
while(query.next())
listWidget->addItem(query.value(1).toString());
}
void VistaMedia::search()
{
QString searchText=searchTextLineEdit->text();
QSqlQuery query;
query.prepare("SELECT * FROM mediadetails WHERE title LIKE %:title% ");
query.bindValue(":title",searchText);
query.exec();
while(query.next())
listWidget->addItem(query.value(1).toString());
QSqlError e=query.lastError () ;
QMessageBox::information(this,"problem",e.text());
}
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!!!!!!!!
Bookmarks