Hi all,
when i want to get the fields of one table in database, i use this code as follows:
tableModel->setTable(tableA);
tableModel->select();
for(int i=0, i<rec.count (), i++)
{
QString fieldName
= field.
fieldName();
qDebug()<<fieldName;
// other
// ....
}
QSqlTableModel tableModel;
tableModel->setTable(tableA);
tableModel->select();
QSqlRecord rec = tableModel->record();
for(int i=0, i<rec.count (), i++)
{
QSqlField field = rec.field(i);
QString fieldName = field.fieldName();
qDebug()<<fieldName;
// other
// ....
}
To copy to clipboard, switch view to plain text mode
here is my question, when i frequently open multiple talbes like this, sometimes i find that qDebug the fields sequence of table is not as the same as the table in database(e.g Oracle) , so anyone knows the reseason?
Thank you very much!
Bookmarks