I'm trying to get a value from a column in my table. I know that the query will only return one result, and I need an int
value...
QSqlQuery qry;
qry.prepare("select Position from workers where Username='"+username+"'and Password='"+password+"'");
qry.exec();
int status = qry.value(0).toInt();
But this doesn't work. In my table there is a field called Position which is INTEGER
, so I'm trying to retrieve it. Again, I know that this qry
will only have one result.
Aucun commentaire:
Enregistrer un commentaire