I am having issues making my program insert data into an SQLLite db file. I am a bit lost due to the ambigious error message aswell, as I am passing the correct parameters to the insert command(?)

Here is the SQL Lite Table structure:

Qt Code:
  1. CREATE TABLE inventory (
  2. id INT PRIMARY KEY NOT NULL,
  3. name CHAR(120) NOT NULL,
  4. description TEXT,
  5. category INT,
  6. employee INT,
  7. location INT
  8. );
To copy to clipboard, switch view to plain text mode 

And here is my QT/C++ Code:

Qt Code:
  1. QSqlQuery query(this->db);
  2.  
  3. if (!this->db.open()) {
  4. qDebug() <<this->db.lastError().text();
  5. }
  6.  
  7. query.prepare
  8. ("INSERT INTO inventory (name, description, category) VALUES (?,?,?)");
  9. query.addBindValue(name);
  10. query.addBindValue(description);
  11. query.addBindValue(category);
  12.  
  13.  
  14.  
  15. if (!query.exec()) {
  16. qDebug() <<query.lastError().text();
  17. }
To copy to clipboard, switch view to plain text mode 

For the record, the QSqlDatabase object is initiated in the constructor, and I am able to run SELECT queries from the database. So the connection works ....


Qt Code:
  1. QSettings settings;
  2. this->db = QSqlDatabase::addDatabase("QSQLITE", "NETTO_CONNECTION");
  3. this->db.setDatabaseName(settings.value("db").toString());
To copy to clipboard, switch view to plain text mode 

Any ideas to what I am doing wrong here?