wumu
2024-01-19 01879e2d0f951ff37ba56df695668d16548070a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "problemrectstandingbook.h"
#include "ui_problemrectstandingbook.h"
 
#include <QSqlQuery>
#include <QDebug>
 
ProblemRectStandingBook::ProblemRectStandingBook(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ProblemRectStandingBook)
{
    ui->setupUi(this);
    searchComName();
}
 
ProblemRectStandingBook::~ProblemRectStandingBook()
{
    delete ui;
}
 
void ProblemRectStandingBook::searchComName()
{
    QSqlQuery query;
    QString sql = QString("select id,name,code from company_info");
    if(query.exec(sql)){
        qDebug()<<"size:"<<query.numRowsAffected();
        while(query.next()){
            int id = query.value(0).toInt();
            QString name = query.value(1).toString();
            QString code = query.value(2).toString();
            qDebug()<<"com select:"<<id<<name;
            m_comInfo[name] = id;
            //m_comCode[name] = code;
            ui->comboBox_company->addItem(name);
        }
    }
}