Never mind, I have fixed the problem. For those who might encounter the same problem is future, the problem was that i added double quotation marks inside the brackets instead of single quotation marks on this line of code QString qryStr = QString("INSERT INTO Modules VALUES(\"%1, %2 %3 %4\")").arg(qry.at(0)).arg(qry.at(1)).arg(qry.at(2 )).arg(qry.at(3)); the correct line is QString qryStr = QString("INSERT INTO Modules VALUES('%1', '%2', '%3', '%4')").arg(qry.at(0)).arg(qry.at(1)).arg(qry.at(2 )).arg(qry.at(3));