do { vlad newV; QSqlRecord rec = read.record(); newV.ID_Owner=rec.field("ID_Owner").value().toInt(); newV.Vlad = rec.field("Владелец").value().toString(); newV.Address = rec.field("Адрес").value().toString(); newV.Num_Phone = rec.field("Телефон").value().toString(); newV.Club = rec.field("Клуб").value().toString(); newV.email = rec.field("e-mail").value().toString(); newV.pitom = rec.field("Питомник").value().toString(); emit this->progDownString(newV.Vlad); crVlad.append(newV); } while (read.next()); qw_4.finish(); QSqlQuery write (dbSql); write.exec("create table Владелец (ID_Owner INTEGER PRIMARY KEY NOT NULL," "Владелец VARCHAR (64) NOT NULL," "Адресс VARCHAR (256)," "Телефон VARCHAR (32)," "Клуб VARCHAR (32) NOT NULL," "email VARCHAR (64)," "Питомник VARCHAR (128)," "constraint Vl_fk FOREIGN KEY (ID_Owner)references Animals (ID_Owner) on update cascade on delete cascade)"); for (int i = 0 ; i < crVlad.size(); i++) { if(!write.prepare("insert into Владелец (ID_Owner,Владелец, Адресс, Телефон, Клуб, email, Питомник)" " values (:qr,:wr,:er,:r,:t,:y,:u)")) { QMessageBox::critical(this,tr ("Ошибка 003"), tr (" Невозможно добавить запись в таблицу 'Владелец' .").append(dbSql.lastError().text())); break; } write.bindValue(":qr",crVlad.at(i).ID_Owner); write.bindValue(":wr",crVlad.at(i).Vlad); write.bindValue(":er",crVlad.at(i).Address); write.bindValue(":r",crVlad.at(i).Num_Phone); write.bindValue(":t",crVlad.at(i).Club); write.bindValue(":y",crVlad.at(i).email); write.bindValue(":u",crVlad.at(i).pitom); emit this->progDownString(crVlad.at(i).Vlad); write.exec(); }
bar = new Prog_bar(this); connect (this, SIGNAL(progDownString(QString)), bar, SLOT(set_down_label(QString)),Qt::DirectConnection); connect(this, SIGNAL(progUpString(QString)), bar, SLOT(set_upLabel(QString)),Qt::DirectConnection); connect (this, SIGNAL(progValPerCent(int)), bar, SLOT(set_prog_value(int)),Qt::DirectConnection);