Problem with SqlLite database in Qt SDK 1.0.2
Posted
by
Risino
on Stack Overflow
See other posts from Stack Overflow
or by Risino
Published on 2011-01-07T09:49:41Z
Indexed on
2011/01/07
9:54 UTC
Read the original article
Hit count: 206
Hi I have a problem with SqlLite database. Here is my code:
void incomeDialog::on_add_pushButton_clicked()
{
int a = ui->income_lineEdit->text().toInt();
int b = ui->other_lineEdit->text().toInt();
int c = (a+b);
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("money.db");
QSqlQuery query(db);
query.exec("create table Income"
"(Month TEXT, Payment NUMBER, Other NUMBER, Together NUMBER)");
query.prepare("INSERT INTO Income values (?,?,?,?)");
query.addBindValue(ui->comboBox->currentText());
query.addBindValue(ui->income_lineEdit->text().toInt());
query.addBindValue(ui->other_lineEdit->text().toInt());
query.addBindValue(c);
query.exec();
}
I use qt sdk 1.0.2. After building shows errors:
Undefined reference to 'QSqlDatabase::addDatabase(QString const&, QString const&)...
all errors is similar (Undefined reference to 'QSqlDatabase::
Do you have any idea how to repair it?
© Stack Overflow or respective owner