void addtrnsc::on_pushButton_clicked() { QSqlDatabase myDB = QSqlDatabase::addDatabase("QSQLITE"); myDB.setDatabaseName(Path_to_DB); if (!myDB.open()) { QMessageBox::critical(0, tr("no Con"), tr("unable to stablish")); return; } QSqlQuery query; query.exec("insert into expense values(Descrition, Amount, Type, Date) VALUES ("+ui->txtDescrip->text()+","+ui->txtamount->text()+","+ui->comboxtype->currentText()+","+ui->dateEdit->text()); }
INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)