I am showing you my problem by showing a screen shot. This seems easier to me.
My Table is empty in my program, but it has the right amount of columns and if I add more columns in my sql workbench it will get more rows, but nothing is displayed in them.
Here is my Source Code:
void adminUserData::on_pushButton_Load_clicked()
{
// This Object is for connecting to my Database (it works).
Datenbank db;
db.connData();
QSqlQueryModel* model = new QSqlQueryModel();
QSqlQuery* qry = new QSqlQuery(db.db);
qry->prepare("SELECT * FROM worker");
qry->exec();
model->setQuery(*qry);
ui->tableView->setModel(modal);
qDebug() << model->rowCount();
db.discData();
}
I have no clue whats wrong. Here is a screen shot of my database in the workbench:
Thank you guys for helping me.
best regards
解决方案
Shouldn't "ui->tableView->setModel(modal);" be "ui->tableView->setModel(model);"?