QSqlDatabase qsdBase_sqlite = QSqlDatabase::addDatabase("QSQLITE","lite");qsdBase_sqlite.setDatabaseName(qsBaseName); QSqlDatabase qsdBase_ibase= QSqlDatabase::addDatabase("QIBASE","ibase");qsdBase_ibase.setHostName("avtomat");qsdBase_ibase.setUserName("USER");qsdBase_ibase.setPassword("password");qsdBase_ibase.setDatabaseName("REFERENCEASP"); QSqlQuery* qsqReadQuery=new QSqlQuery(qsdBase_sqlite);QSqlQuery* qsqWriteQuery=new QSqlQuery(qsdBase_ibase);qsqReadQuery->exec("SELECT COUNT(ID) FROM reftbl");qsqReadQuery->first();int iCount=qsqReadQuery->value(0).toInt();qsqReadQuery->exec("SELECT * FROM reftbl");if (!qsqReadQuery->isActive()){ QMessageBox::critical(0, QCoreApplication::applicationName(),qsqReadQuery->lastError().text()); return 0;}QProgressDialog* qpdProgress=new QProgressDialog("Loading...", "Cancel", 0, iCount);qpdProgress->setWindowModality(Qt::WindowModal);while (qsqReadQuery->next()){ qpdProgress->setValue(qpdProgress->value()+1); qsqWriteQuery->prepare(QString("SELECT * FROM REFTBL WHERE ID=")+qsqReadQuery->value(0).toString()); bool bResult=qsqWriteQuery->exec(); if (bResult) qsqWriteQuery->prepare("UPDATE REFTBL SET NUMBERDELO=:NUMBERDELO,FAMIL=:FAMIL,NAME=:NAME,OTCH=:OTCH,REFTYPE=:REFTYPE,UID=:UID,REFDATE=:REFDATE,REFTEXT=:REFTEXT WHERE ID=:ID"); else qsqWriteQuery->prepare("INSERT INTO REFTBL (ID,NUMBERDELO,FAMIL,NAME,OTCH,REFTYPE,UID,REFDATE,REFTEXT) VALUES (:ID,:NUMBERDELO,:FAMIL,:NAME,:OTCH,:REFTYPE,:UID,:REFDATE,:REFTEXT)"); qsqWriteQuery->bindValue(":ID",qsqReadQuery->value(0)); qsqWriteQuery->bindValue(":NUMBERDELO",qsqReadQuery->value(1)); qsqWriteQuery->bindValue(":FAMIL",qsqReadQuery->value(2)); qsqWriteQuery->bindValue(":NAME",qsqReadQuery->value(3)); qsqWriteQuery->bindValue(":OTCH",qsqReadQuery->value(4)); qsqWriteQuery->bindValue(":REFTYPE",qsqReadQuery->value(5)); qsqWriteQuery->bindValue(":UID",qsqReadQuery->value(6)); qsqWriteQuery->bindValue(":REFDATE",qsqReadQuery->value(7).toDateTime()); qsqWriteQuery->bindValue(":REFTEXT",qsqReadQuery->value(8).toString().toUtf8()); if (!qsqWriteQuery->exec()) { QMessageBox::critical(0, QCoreApplication::applicationName(),qsqWriteQuery->lastError().text()); return 0; }}