void IS on_pushButton_clicke IS conn QSqlQueryModel modal new QSqlQuer

 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
37
38
39
40
41
void IS::on_pushButton_clicked()
{
IS conn;
QSqlQueryModel * modal=new QSqlQueryModel();
conn.connOpen();
QSqlQuery* qry=new QSqlQuery(conn.ZOO);
if (ui->radioButton->isChecked())
{
qry->prepare("select Name, Vid, Otr, Sem, Kol from ZOO1 order by Name") ;
}
if (ui->radioButton_2->isChecked())
{
qry->prepare("select Name, Vid, Otr, Sem, Kol from ZOO1 order by Vid") ;
}
if (ui->radioButton_3->isChecked())
{
qry->prepare("select Name, Vid, Otr, Sem, Kol from ZOO1 order by Otr") ;
}
if (ui->radioButton_4->isChecked())
{
qry->prepare("select Name, Vid, Otr, Sem, Kol from ZOO1 order by Sem") ;
}
if (ui->radioButton_5->isChecked())
{
qry->prepare("select Name, Vid, Otr, Sem, Kol from ZOO1 order by Kol") ;
}
qry->exec();
modal->setQuery(*qry);
ui->tableView->setModel(modal);
conn.connClose();
qDebug() << (modal->rowCount());
on_pushButton_loadtabl_clicked();
}