Answer the question
In order to leave comments, you need to log in
How to display result of Postgresql function in QSqlTableModel?
there is a function in the PostgreSQl database find( int )
it takes numeric values
returns tabular data
how to display this result in QSqlTableModel?
tried like this:
model->setTable("find(4161)");
model->select();
But no result
Answer the question
In order to leave comments, you need to log in
Because setTable points to the name of a table, not a function.
functions are called via SELECT, you need to use
QSqlQueryModel
QSqlQueryModel *getFind = new QSqlQueryModel;
getFind ->setQuery(" SELECT find(4161)'");
if(getFind ->lastError().isValid()){
qDebug() << getFind ->lastError();
}
model->setModel(getFind );
model->select();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question