@Kofr
Hello,
Your SQL is incorrect. Create the table and then insert the rows.
QSqlQuery query("CREATE TABLE tasks (taskId INTEGER, PRIMARY KEY(taskId))");
if (!query.exec())
; //< Handle error - table couldn't be created
query.prepare("INSERT INTO tasks (taskId) VALUES (:id)");
// From here on you can have multiple calls to the same piece of code to insert multiple rows
query.bindValue(":id", valueForInitialization);
if (!query.exec())
; //< Handle error - can't insert row
Additionally, I advise you to create the table once and for all. Then just fill it up, instead of trying to create it on every row insertion.
Kind regards.