foxrider
7th May 2014, 16:19
Hello !!!
I am trying to load my data base table to tableView.I have written the following piece of code.
void UserLog::on_pushButton_7_clicked()
{
login conn;
QSqlQueryModel *modal =new QSqlQueryModel;
conn.connOpen();
QSqlQuery* qry = new QSqlQuery(conn.db);
qry->prepare("select * from `posdb`.items");
if(qry->exec())
{
modal->setQuery(*qry);
ui->tableView->setModel(modal);
conn.connClose();
}
else
{
QMessageBox::critical(this,tr("error::"),qry->lastError().text());
}
qDebug() <<(modal->rowCount());
}
It is successfully loading the table.But the problem is that the table fields are empty10340
I do not guess what is the wrong with my code.I am using the following version of Qt 10341
My database table is 10342
I am afraid what to do.
Help !!!
Thanks
I am trying to load my data base table to tableView.I have written the following piece of code.
void UserLog::on_pushButton_7_clicked()
{
login conn;
QSqlQueryModel *modal =new QSqlQueryModel;
conn.connOpen();
QSqlQuery* qry = new QSqlQuery(conn.db);
qry->prepare("select * from `posdb`.items");
if(qry->exec())
{
modal->setQuery(*qry);
ui->tableView->setModel(modal);
conn.connClose();
}
else
{
QMessageBox::critical(this,tr("error::"),qry->lastError().text());
}
qDebug() <<(modal->rowCount());
}
It is successfully loading the table.But the problem is that the table fields are empty10340
I do not guess what is the wrong with my code.I am using the following version of Qt 10341
My database table is 10342
I am afraid what to do.
Help !!!
Thanks