Perhaps this an issue for the bug tracker.
Here's that really simple code, i want to run:
#include <QtGui>
#include <QtSql>
#include <QtDebug>
int main(int argc, char *argv[])
{
db.setHostName("localhost");
db.setDatabaseName("c5testdb");
db.setUserName("root");
db.setPassword("");
if(!db.open()) {
return 1;
}
model.setTable("users");
model.select();
tableView.setModel(&model);
tableView.setWindowTitle("SQL-Demonstration");
tableView.show();
return a.exec();
}
#include <QtGui>
#include <QtSql>
#include <QtDebug>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setDatabaseName("c5testdb");
db.setUserName("root");
db.setPassword("");
if(!db.open()) {
QSqlError err = db.lastError();
QMessageBox::information(0, QObject::tr("Fehler!"), err.text());
return 1;
}
QTableView tableView;
QSqlTableModel model;
model.setTable("users");
model.select();
model.setEditStrategy(QSqlTableModel::OnFieldChange);
tableView.setModel(&model);
tableView.setWindowTitle("SQL-Demonstration");
tableView.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks