You have to create the query string passing
num
as parameter to a string formatting function. Because
QSqlQuery::prepare() | Qt SQL 5.10[
^] expects a
QString
argument, it can be be done in a single statement:
qry.prepare(QString("SELECT * FROM ISSUEPASS WHERE PassID =%1").arg(num));
But SQL commands should never use created text strings to avoid SQL injections (here it would be OK because there is no text parameter). The preferred solution is using parametrised queries:
qry.prepare("SELECT * FROM ISSUEPASS WHERE PassID =:passId");
qry.bindValue(":passId", num);