1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
QSqlDatabase base = QSqlDatabase::addDatabase("QSQLITE");
base.setDatabaseName(QDir::fromNativeSeparators(QDir::homePath()+"/.QFacturation/data.db"));
if(!base.open())
return false;
QSqlQuery query;
query.prepare("UPDATE customer SET name=:name, adress=:adress, adress2=:adress2, postalCode=:postalCode, city=:city, country=:country,email=:email,phone=:phone WHERE idCustomer=:id )");
query.bindValue(":name",name);
query.bindValue(":adress",adress);
query.bindValue(":adress2",adress2);
query.bindValue(":postalCode",postalCode);
query.bindValue(":city",city);
query.bindValue(":country",country);
query.bindValue(":email",email);
query.bindValue(":phone",phone);
query.bindValue(":id",id);
qDebug()<<query.executedQuery(); // me retourne UPDATE customer SET name=?, adress=?, adress2=?, postalCode=?, city=?, country=?,email=?,phone=? WHERE idCustomer=? )
retour=query.exec(); // retourne false
qDebug()<<query.lastError().text();
base.commit();
base.close(); QSqlDatabase::removeDatabase(QDir::fromNativeSeparators(QDir::homePath()+"/.QFacturation/data.db")); |
Partager