I'm beginner in qt. I'm using qt5 in ubuntu. I want to select some columns from a table in mysql database where one column(id) is equal to a variable in integer type. What should I do? I wrote this code but I have error!
QSqlQuery query;
int k=10;
query.exec("select name,family from employees where id='"+k+"'");
while(query.next()){
qDebug()<<query.value(0).toString();
qDebug()<<query.value(1).toString();
}
And this is the error:
invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
query.exec("select name,family from employees where id='"+k+"'");