thefatladysingsopera
12th August 2011, 07:40
I have the following code in my save function.
void smith::on_saveButton_clicked()
{
QSqlQuery query;
query.prepare(
"INSERT INTO application (firstname, lastname, country, city)) "
"VALUES (:firstname, :lastname, :country, :city)"
);
query.bindValue(":firstname", "Alexis");
query.bindValue(":lastname", "Nicholov");
query.bindValue(":country", "Russia");
query.bindValue(":city","Moscow");
query.exec();
}
The database connection is alright but it wont insert.Why?.
void smith::on_saveButton_clicked()
{
QSqlQuery query;
query.prepare(
"INSERT INTO application (firstname, lastname, country, city)) "
"VALUES (:firstname, :lastname, :country, :city)"
);
query.bindValue(":firstname", "Alexis");
query.bindValue(":lastname", "Nicholov");
query.bindValue(":country", "Russia");
query.bindValue(":city","Moscow");
query.exec();
}
The database connection is alright but it wont insert.Why?.