I am writing a function that will take a string variable and work with a column with the name of this variable, but i can't figure out how to write variable in select
I tried this where test is QString variable with value company, but it didnt work like if there was company without variable
QString test = "company";
QSqlQuery password = db->exec("SELECT password FROM '" test "'");
CodePudding user response:
Worked with deleted '' of the variable.
QSqlQuery password = db->exec("SELECT password FROM " test "");