Hi
I have the following code :
void MainWindow::on_pushButton_clicked()
{
db.setDatabaseName("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=d:/");
qDebug() << db.open();
qDebug() << db.tables();
query.prepare("INSERT INTO test(P1)"
"VALUES (9999)");
query.exec();
while (query.next()) {
QString test
= query.
value(0).
toString();
qDebug () << test;
}
}
void MainWindow::on_pushButton_clicked()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=d:/");
qDebug() << db.open();
qDebug() << db.tables();
QSqlQuery query = QSqlQuery("SELECT * FROM dzialka", db);
query.prepare("INSERT INTO test(P1)"
"VALUES (9999)");
query.exec();
while (query.next()) {
QString test = query.value(0).toString();
qDebug () << test;
}
}
To copy to clipboard, switch view to plain text mode
Why If I add the lines :
query.prepare("INSERT INTO test(P1)"
"VALUES (9999)");
query.exec();
query.prepare("INSERT INTO test(P1)"
"VALUES (9999)");
query.exec();
To copy to clipboard, switch view to plain text mode
The lopp while does not work ? because the "curosor" is set on the last posiotion ?
Regards
Artur
Bookmarks