当前位置: 首页>>代码示例>>C++>>正文


C++ QSqlError::text方法代码示例

本文整理汇总了C++中QSqlError::text方法的典型用法代码示例。如果您正苦于以下问题:C++ QSqlError::text方法的具体用法?C++ QSqlError::text怎么用?C++ QSqlError::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSqlError的用法示例。


在下文中一共展示了QSqlError::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runQuery

void SQLManager::runQuery(const QString &text, const QString &connection)
{
  kDebug() << "connection:" << connection;
  kDebug() << "text:"       << text;

  if (text.isEmpty())
    return;

  if (!isValidAndOpen(connection))
    return;

  QSqlDatabase db = QSqlDatabase::database(connection);
  QSqlQuery query(db);

  if (!query.prepare(text))
  {
    QSqlError err = query.lastError();

    if (err.type() == QSqlError::ConnectionError)
      m_model->setStatus(connection, Connection::OFFLINE);

    emit error(err.text());
    return;
  }

  if (!query.exec())
  {
    QSqlError err = query.lastError();

    if (err.type() == QSqlError::ConnectionError)
      m_model->setStatus(connection, Connection::OFFLINE);

    emit error(err.text());
    return;
  }

  QString message;

  /// TODO: improve messages
  if (query.isSelect())
  {
    if (!query.driver()->hasFeature(QSqlDriver::QuerySize))
      message = i18nc("@info/plain", "Query completed successfully");
    else
    {
      int nRowsSelected = query.size();
      message = i18ncp("@info/plain", "%1 record selected", "%1 records selected", nRowsSelected);
    }
  }
  else
  {
    int nRowsAffected = query.numRowsAffected();
    message = i18ncp("@info/plain", "%1 row affected", "%1 rows affected", nRowsAffected);
  }

  emit success(message);
  emit queryActivated(query, connection);
}
开发者ID:azat-archive,项目名称:kate,代码行数:58,代码来源:sqlmanager.cpp

示例2: deleteTemplate

void tableTemplateWidget::deleteTemplate(void)
{
  if (templateId == 0)
    return;

  QMessageBox delTmp(QMessageBox::Question,
                     tr("Deleting template!"),
                     tr("Do you want delete template ?"),
                     QMessageBox::Yes | QMessageBox::No);

  int code = delTmp.exec();

  if (code == QMessageBox::No)
    return;

  QSqlQuery query;
  QSqlError le;

  query.prepare("DELETE FROM crossword.private_data WHERE _template = ?;");
    query.addBindValue(QVariant(templateId));
  query.exec();

  le = query.lastError();
  if (le.type() != QSqlError::NoError)
    qDebug() << "1. deleteTemplate: " << le.text();

  query.prepare("DELETE FROM crossword.grids WHERE _template = ?;");
    query.addBindValue(QVariant(templateId));
  query.exec();

  le = query.lastError();
  if (le.type() != QSqlError::NoError)
    qDebug() << "2. deleteTemplate: " << le.text();

  query.prepare("DELETE FROM crossword.templates WHERE _id = ?;");
    query.addBindValue(QVariant(templateId));
  query.exec();

  le = query.lastError();
  if (le.type() != QSqlError::NoError)
    qDebug() << "3. deleteTemplate: " << le.text();

  for (int i = 0; i < numCol; i++)
    removeColumn(0);

  setRowCount(0);

  sb->showMessage(tr("Template deleted"), 2000);

  // need for templateListWidget
  emit deletedFromDB(templateId);

  numCol = numRow = 0;
  templateId = 0;
  countWords = 0;
  wi.clear();
}
开发者ID:skydion,项目名称:qtcrossword,代码行数:57,代码来源:tabletemplatewidget.cpp

示例3: checkDatabaseError

void checkDatabaseError(const QSqlDatabase &db) {
    QSqlError lastError = db.lastError();
    if (lastError.type() != QSqlError::NoError) {
#if QT_VERSION >= 0x050300
        throw Exception { lastError.nativeErrorCode().toInt(), lastError.text().toStdString() };
#else
        throw Exception { lastError.number(), lastError.text().toStdString() };
#endif
    }
}
开发者ID:1SpatialGroupLtd,项目名称:mapbox-gl-native,代码行数:10,代码来源:sqlite3.cpp

示例4: isLockError

bool SqlUtils::isLockError(const QSqlError& error)
{
    if (error.type() == QSqlError::StatementError &&
        ( error.text().contains(QLatin1String("(55P03)")) || //the actual error code, not translated. needs patched QPSQL driver
          error.text().contains(QLatin1String("could not obtain lock")) )
       )
    {
        return true;
    }
    return false;
}
开发者ID:02JanDal,项目名称:sqlate,代码行数:11,代码来源:SqlUtils.cpp

示例5: WHERE

QList<geodbObject> GeodbSql::getStreetList(QString text)
{
    QList<geodbObject> geodbObjectList;
    QString CommandText = "SELECT DISTINCT plz_code.loc_id AS id_PLZ, plz_code.text_val AS PLZ, stadt.loc_id AS id_Stadt, stadt.text_val AS Stadt, bezirk.loc_id AS id_Bezirk, bezirk.text_val AS Bezirk, ortsteil.loc_id AS id_Ortsteil, ortsteil.text_val AS Ortsteil, street.loc_id AS id_Strasse, street.text_val AS Strasse, street.valid_since AS Strasse_Von, street.valid_until AS Strasse_Bis, street.text_type AS Strasse_Typ, coord.loc_id AS id_LatLong, coord.valid_since AS LatLong_Von, coord.valid_until AS LatLong_Bis, coord.lat AS Latitude, coord.lon AS Longitude FROM geodb_textdata_berlin street, geodb_textdata_berlin plz_code_such, geodb_textdata_berlin plz_code, geodb_textdata_berlin ortsteil_such, geodb_textdata_berlin ortsteil, geodb_textdata_berlin bezirk_such, geodb_textdata_berlin bezirk, geodb_textdata_berlin stadt_such, geodb_textdata stadt, geodb_coordinates_berlin coord WHERE  ((street.text_val RLIKE :searchText) AND (street.text_type >= 101100000) AND (street.text_type <= 101400000)) AND ((plz_code_such.loc_id = street.loc_id) AND  (plz_code_such.text_type = 400100000)) AND ((plz_code.loc_id = plz_code_such.text_val) AND  (plz_code.text_type = 500300000)) AND ((ortsteil_such.loc_id = street.loc_id) AND  (ortsteil_such.text_type = 400100000)) AND ((ortsteil.loc_id = ortsteil_such.text_val) AND  (ortsteil.text_type = 101000000)) AND ((bezirk_such.loc_id = ortsteil.loc_id) AND  (bezirk_such.text_type = 400100000)) AND ((bezirk.loc_id = bezirk_such.text_val) AND  (bezirk.text_type = 100900000)) AND ((stadt_such.loc_id = bezirk.loc_id) AND  (stadt_such.text_type = 400100000)) AND ((stadt.loc_id = stadt_such.text_val) AND  (stadt.text_type = 500100000)) AND ((coord.loc_id = street.loc_id))  AND  (((street.valid_since >= '0001-01-01') AND (street.valid_until <= '3000-01-01'))  AND  ((plz_code_such.valid_since < street.valid_until) AND (plz_code_such.valid_until >= street.valid_until))  AND  ((plz_code.valid_since < street.valid_until) AND (plz_code.valid_until >= street.valid_until))  AND  ((ortsteil_such.valid_since < street.valid_until) AND (ortsteil_such.valid_until >= street.valid_until))  AND  ((ortsteil.valid_since < street.valid_until) AND (ortsteil.valid_until >= street.valid_until))  AND  ((bezirk_such.valid_since < street.valid_until) AND (bezirk_such.valid_until >= street.valid_until))  AND  ((bezirk.valid_since < street.valid_until) AND (bezirk.valid_until >= street.valid_until))  AND  ((stadt_such.valid_since < street.valid_until) AND (stadt_such.valid_until >= street.valid_until))  AND  ((stadt.valid_since < street.valid_until) AND (stadt.valid_until >= street.valid_until))  AND  ((coord.valid_since < street.valid_until) AND (coord.valid_until >= street.valid_until)))  UNION SELECT DISTINCT 0 AS id_PLZ, 'na' AS PLZ, stadt.loc_id AS id_Stadt, stadt.text_val AS Stadt, bezirk.loc_id AS id_Bezirk, bezirk.text_val AS Bezirk, ortsteil.loc_id AS id_Ortsteil, ortsteil.text_val AS Ortsteil, transport.loc_id AS id_Strasse, transport.text_val AS Strasse, transport.valid_since AS Strasse_Von, transport.valid_until AS Strasse_Bis, transport.text_type AS Strasse_Typ, coord.loc_id AS id_LatLong, coord.valid_since AS LatLong_Von, coord.valid_until AS LatLong_Bis, coord.lat AS Latitude, coord.lon AS Longitude FROM geodb_textdata_berlin_transport transport, geodb_textdata_berlin_transport ortsteil_such, geodb_textdata_berlin ortsteil, geodb_textdata_berlin bezirk_such, geodb_textdata_berlin bezirk, geodb_textdata_berlin stadt_such, geodb_textdata stadt, geodb_coordinates_berlin coord WHERE  ((transport.text_val RLIKE :searchText) AND (transport.text_type > 101100000) AND (transport.text_type <= 101400000)) AND ((ortsteil_such.loc_id = transport.loc_id) AND  (ortsteil_such.text_type = 400100000)) AND ((ortsteil.loc_id = ortsteil_such.text_val) AND  (ortsteil.text_type = 101000000)) AND ((bezirk_such.loc_id = ortsteil.loc_id) AND  (bezirk_such.text_type = 400100000)) AND ((bezirk.loc_id = bezirk_such.text_val) AND  (bezirk.text_type = 100900000)) AND ((stadt_such.loc_id = bezirk.loc_id) AND  (stadt_such.text_type = 400100000)) AND ((stadt.loc_id = stadt_such.text_val) AND  (stadt.text_type = 500100000)) AND ((coord.loc_id = transport.loc_id))  AND  (((transport.valid_since >= '0001-01-01') AND (transport.valid_until <= '3000-01-01'))  AND  ((ortsteil_such.valid_since < transport.valid_until) AND (ortsteil_such.valid_until >= transport.valid_until))  AND  ((ortsteil.valid_since < transport.valid_until) AND (ortsteil.valid_until >= transport.valid_until))  AND  ((bezirk_such.valid_since < transport.valid_until) AND (bezirk_such.valid_until >= transport.valid_until))  AND  ((bezirk.valid_since < transport.valid_until) AND (bezirk.valid_until >= transport.valid_until))  AND  ((stadt_such.valid_since < transport.valid_until) AND (stadt_such.valid_until >= transport.valid_until))  AND  ((stadt.valid_since < transport.valid_until) AND (stadt.valid_until >= transport.valid_until))  AND  ((coord.valid_since < transport.valid_until) AND (coord.valid_until >= transport.valid_until)))  UNION SELECT DISTINCT 0 AS id_PLZ, 'na' AS PLZ, land.loc_id AS id_Stadt, land.text_val AS Stadt, kreis.loc_id AS id_Bezirk, kreis.text_val AS Bezirk, name.loc_id AS id_Ortsteil, name.text_val AS Ortsteil, transport2.loc_id AS id_Strasse, transport2.text_val AS Strasse, transport2.valid_since AS Strasse_Von, transport2.valid_until AS Strasse_Bis, transport2.text_type AS Strasse_Typ, coord.loc_id AS id_LatLong, coord.valid_since AS LatLong_Von, coord.valid_until AS LatLong_Bis, coord.lat AS Latitude, coord.lon AS Longitude FROM geodb_textdata_berlin_transport transport2, geodb_textdata_berlin_transport name_such, geodb_textdata name, geodb_textdata kreis, geodb_textdata kreis_such, geodb_textdata land_such, geodb_textdata land, geodb_coordinates_berlin coord WHERE  ((transport2.text_val RLIKE :searchText) AND (transport2.text_type > 101100000) AND (transport2.text_type <= 101400000)) AND ((name_such.loc_id = transport2.loc_id) AND  (name_such.text_type = 400100000)) AND ((name.loc_id = name_such.text_val) AND  (name.text_type = 500100000)) AND ((kreis_such.loc_id = name.loc_id) AND  (kreis_such.text_type = 400100000)) AND ((kreis.loc_id = kreis_such.text_val) AND  (kreis.text_type = 500100000)) AND ((land_such.loc_id = kreis.loc_id) AND  (land_such.text_type = 400100000)) AND ((land.loc_id = land_such.text_val) AND  (land.text_type = 500100000)) AND ((coord.loc_id = transport2.loc_id))  ORDER BY Stadt, Strasse, PLZ, Bezirk, Ortsteil";
    QSqlQuery query = QSqlQuery(db);
    if(!query.prepare(CommandText))
    {
        QSqlError err = query.lastError();
        qDebug() << err.text() + "\n";
        qDebug() << CommandText + " line:" + QString("%1").arg(__LINE__) +"\n";
    }
    //query.bindValue(":searchText", "'"+text+"'");
    CommandText.replace(":searchText", "'"+text+"'");
    //qDebug()<<CommandText;
    bool bQuery = query.exec(CommandText);
    if(!bQuery)
    {
        QSqlError err = query.lastError();
        qDebug() << err.text() + "\n";
        qDebug() << CommandText + " line:" + QString("%1").arg(__LINE__) +"\n";
        db.close();
        exit(EXIT_FAILURE);
    }
    while(query.next())
    {
        geodbObject go;
        go.id_PLZ = query.value(0).toInt();
        go.PLZ = query.value(1).toString();
        go.idStadt = query.value(2).toInt();
        go.Stadt = query.value(3).toString();
        go.idBezirk = query.value(4).toInt();
        go.Bezirk = query.value(5).toString();
        go.idOrsteil=query.value(6).toInt();
        go.Ortstiel = query.value(7).toString();
        go.idStrasse = query.value(8).toInt();
        go.Strasse = query.value(9).toString();
        go.Strasse_von = query.value(10).toString();
        go.Strasse_bis = query.value(11).toString();
        go.Strasse_type = query.value(12).toInt();
        go.idLatLong = query.value(13).toInt();
        go.LatLong_von = query.value(14).toString();
        go.LatLon_bis = query.value(15).toString();
        go.latitude = query.value(16).toDouble();
        go.longitude = query.value(17).toDouble();
        geodbObjectList.append(go);
    }
    return geodbObjectList;
}
开发者ID:allenck,项目名称:mapper,代码行数:48,代码来源:geodbsql.cpp

示例6: on_buttonBox_accepted

void firstDiagnostics::on_buttonBox_accepted()
{

    QSqlDatabase::database().transaction();
    QSqlQuery query;
    query.prepare("insert into diagnosis(fk_customer, fk_doctor, type, fk_partner, dateD, timeD) values(?, ?, ?, ?, ?, ?)");
    query.addBindValue(customerID);
    query.addBindValue(ui->doctorCombobox->itemData(ui->doctorCombobox->currentIndex()));
    query.addBindValue(0);
    query.addBindValue(partnerID);
    query.addBindValue(ui->dateEdit->date());
    query.addBindValue(ui->timeEdit->time());
    query.exec();
    query.clear();
    query.prepare("select fk_customerCard from Customer where id = ?");
    query.addBindValue(customerID);
    query.exec();
    int cardID = 0;
    if(query.next())
        cardID = query.value(0).toInt();
    query.clear();
    query.prepare("insert into custCardDoctor values(?, ?)");
    query.addBindValue(cardID);
    query.addBindValue(ui->doctorCombobox->itemData(ui->doctorCombobox->currentIndex()));
    query.exec();
    if(!QSqlDatabase::database().commit())
    {
        QSqlError err;
        err = QSqlDatabase::database().lastError();
        QSqlDatabase::database().rollback();
        QMessageBox::warning(this, tr("Error"), err.text());

    }
    this->deleteLater();
}
开发者ID:seacomandor,项目名称:DetaDoc,代码行数:35,代码来源:firstdiagnostics.cpp

示例7: apply

bool DDbConfig::apply()
{
    bool isSql = false;
    {
        QSqlDatabase db = QSqlDatabase::addDatabase( cbDriver->currentText(), "test" );
        db.setHostName( edtDbHost->text() );
        db.setDatabaseName( edtDbName->text() );
        db.setUserName( edtDbUser->text() );
        db.setPassword( edtDbPassword->text() );
        db.setPort( sbDbPort->value() );
        db.setConnectOptions( edtDbOptions->toPlainText() );

        isSql = db.open();

        if (!isSql) { // Error
            QSqlError err = db.lastError();
            QMessageBox::warning( this, tr("Not connected"),
                                  tr("Can't create connection to SQL server.\nError text: %1")
                                  .arg(err.text()) );
        } else {
            db.close();
            QMessageBox::information( this, tr("Connection sucsessfull"),
                                      tr("Connection to data base succsessfully created.") );
        }
    }
    QSqlDatabase::removeDatabase( "test" );

    return isSql;
}
开发者ID:disable13,项目名称:myIncDatabase,代码行数:29,代码来源:ddbconfig.cpp

示例8: on_okButton_clicked

void ConnDlg::on_okButton_clicked()
{
    if (ui.comboDriver->currentText().isEmpty())
    {
        ui.status_label->setText(tr("请选择一个数据库驱动!"));
        ui.comboDriver->setFocus();
    }
    else if(ui.comboDriver->currentText() =="QSQLITE")
    {
        addSqliteConnection();
        //创建数据库表,如已存在则无须执行
        creatDB();
        accept();
    }
    else
    {
        QSqlError err = addConnection(driverName(), databaseName(), hostName(),userName(), password(), port());
        if (err.type() != QSqlError::NoError)
            ui.status_label->setText(err.text());
        else
            ui.status_label->setText(tr("连接数据库成功!"));
        //创建数据库表,如已存在则无须执行
        accept();
        }
}
开发者ID:Pengfei-Gao,项目名称:develop-reference-data,代码行数:25,代码来源:connectdlg.cpp

示例9: on_buttonBox_accepted

void partner::on_buttonBox_accepted()
{
	QSqlQuery query;
	if(mode == insertMode)
	{

		query.prepare("insert into Partner(Name, Surname, Patronimic, pasport_data, phone) values(?,?,?,?,?)");
		query.addBindValue(ui->nameEdit->text());
		query.addBindValue(ui->surnameEdit->text());
		query.addBindValue(ui->patronimicEdit->text());
		query.addBindValue(ui->passportEdit->text());
		query.addBindValue(ui->phoneEdit->text());
	}
	else if(mode == updateMode)
	{
		query.prepare("update Partner set Name=?, Surname=?, Patronimic=?, pasport_data=?, phone=? where id=?");
		query.addBindValue(ui->nameEdit->text());
		query.addBindValue(ui->surnameEdit->text());
		query.addBindValue(ui->patronimicEdit->text());
		query.addBindValue(ui->passportEdit->text());
		query.addBindValue(ui->phoneEdit->text());
		query.addBindValue(id);
	}
	if (!query.exec())
	{
		QSqlError err;
		err = query.lastError();
		QMessageBox::warning(this, tr("Error"), err.text());
	}

	this->deleteLater();
}
开发者ID:seacomandor,项目名称:DetaDoc,代码行数:32,代码来源:partner.cpp

示例10: execute

	QScriptValue Sql::execute(const QString &queryString)
	{
        bool result = false;

        if(queryString.isEmpty())
		{
            result = mQuery.exec();
		}
        else
        {
            mQuery = QSqlQuery(*mDatabase);
            mQuery.setForwardOnly(true);

            result = mQuery.exec(queryString);
        }

        if(!result)
		{
			QSqlError error = mQuery.lastError();
			throwError("ExecuteQueryError", tr("Failed to execute the query : %1").arg(error.text()));
			return thisObject();
		}

		return thisObject();
	}
开发者ID:sakazuki,项目名称:actiona,代码行数:25,代码来源:sql.cpp

示例11: processSqlCommands

int KraftDB::processSqlCommands( const SqlCommandList& commands )
{
    int cnt = 0;

    foreach( SqlCommand cmd, commands ) {
        if( !cmd.message().isEmpty() ) {
            emit statusMessage( cmd.message() );
        }

        if( !cmd.command().isEmpty() ) {
            bool res = true;
            QSqlQuery q;
            q.clear();
            res = q.exec(cmd.command()) || cmd.mayfail();

            if ( res ) {
                kDebug() << "Successful SQL Command: " << cmd.command() << endl;
                cnt ++;
            } else {
                QSqlError err = q.lastError();
                res = false;
                kDebug() << "###### Failed SQL Command " << cmd.command() << ": " << err.text() << endl;
            }
            q.clear();
            emit processedSqlCommand( res );

        }
    }
    return cnt;
}
开发者ID:KDE,项目名称:kraft,代码行数:30,代码来源:kraftdb.cpp

示例12: submitAll

void XModel::submitAll(){
	bool b = QSqlRelationalTableModel::submitAll();
    if(b == false){
    	QSqlError err = lastError();
    	yERROR(err.text());
    }
}
开发者ID:tasosbull,项目名称:yewtic,代码行数:7,代码来源:XModel.cpp

示例13: loadKTSs

bool SvDeviceEditor::loadKTSs()
{
  QSqlQuery* q = new QSqlQuery(SQLITE->db);
  QSqlError serr = SQLITE->execSQL(QString(SQL_SELECT_KTSS_LIST), q); 
  if(QSqlError::NoError != serr.type()) {
    
    _last_error = serr.text();
    delete q;
    return false;
  }

  while(q->next())
    ui->cbDeviceType->addItem(q->value("kts_name").toString(), q->value("kts_id").toUInt());
  
  q->finish();
  delete q;
  
  if(ui->cbDeviceType->count()) ui->cbDeviceType->setCurrentIndex(0);
  ui->bnSave->setEnabled(!ui->cbDeviceType->currentData().isNull());
  
  connect(ui->cbDeviceType, SIGNAL(currentIndexChanged(int)), this, SLOT(updateKTSInfo(int)));
  
  return true;
  
}
开发者ID:breton75,项目名称:niirpi,代码行数:25,代码来源:sv_device_editor.cpp

示例14: add

int PushDAO::add(const Push &push)
{
    int insertId = -1;
    QSqlQuery sqlQuery(SQLConnection());

    const QString query("INSERT INTO push (seqnum, pushdate, type, pushtime, extension, content, unread)"
                        "VALUES(:seqnum, :pushdate, :type, :pushtime, :extension, :content, :unread)");

    sqlQuery.prepare(query);

    sqlQuery.bindValue(":pushdate", push.pushDateAsString());
    sqlQuery.bindValue(":type", push.contentType());
    sqlQuery.bindValue(":pushtime", push.pushTime());
    sqlQuery.bindValue(":extension", push.fileExtension());
    sqlQuery.bindValue(":content", push.content().toBase64(), QSql::In | QSql::Binary);
    sqlQuery.bindValue(":unread", push.unread());
    sqlQuery.exec();

    const QSqlError err = sqlQuery.lastError();

    if (err.isValid()) {
        qWarning() << "Error executing SQL statement: " << query << ". ERROR: " << err.text();
    } else {
        if (sqlQuery.lastInsertId().isValid()) {
            insertId = sqlQuery.lastInsertId().toInt();
        }
    }

    return insertId;
}
开发者ID:ProLove365,项目名称:Cascades-Samples,代码行数:30,代码来源:PushDAO.cpp

示例15: newentry

void dataeditfrm::newentry()
{
    //prepare supplier entry
    int i, ii;
    QString supl = "";
    for(i=0;i<tabsuppliers->rowCount();i++)
    {
    	for(ii=0; ii<tabsuppliers->columnCount(); ii++)
    	{
    		QTableWidgetItem *item = new QTableWidgetItem;
    		item = tabsuppliers->item(i, ii);
    		if(item != 0)
    			supl += tabsuppliers->item(i, ii)->text() + ":#:";
			supl = supl.leftJustified(supl.length()-1, '.', true) + "#:";
   		}
   	}
    
    QString state = "0";
    if(chkactive->isChecked())
		state = "1";
    QString connstr = QString("INSERT INTO `"+lbldatatab->text()+"` (`ID`, `col1`, `col2`, `col3`, `col4`, `col5`, `col6`, `col7`, `col8`, `col9`, `col10`, `col11`, `col12`, `col13`, `col14`, `col15`, `col16`, `col17`, `col18`, `col19`, `col20`, `col21`) VALUES (NULL, '%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9'").arg(txtlabel->text()).arg(txtdescription->toPlainText()).arg(txtstock->text()).arg(txtminquantity->text()).arg(txtunit->text()).arg(txtorderquantity->text()).arg(txtpurchaseprice->text()).arg(txtsellprice->text()).arg(supl);
    connstr += QString(", '%1', '%2', '%3', '%4', '%5', '%6'").arg(txtpackage->text()).arg(txtweight->text()).arg(cmbvat->currentIndex()).arg(state).arg(txtwebname->text()).arg(txtwebimage->text());
    connstr += QString(", '%1', '%2', '%3', '%4', '%5', '%6');").arg(txtweburl->text()).arg(QDate::currentDate().toString("yyyy-MM-dd")).arg(QDate::currentDate().toString("yyyy-MM-dd")).arg(txtsalesdate->date().toString("yyyy-MM-dd")).arg(txtcomments->toPlainText()).arg(txtstockpos->text());
    QSqlQuery query(connstr);
    
    QSqlError qerror = query.lastError();
	if(qerror.isValid())
		QMessageBox::information ( 0, tr ( "Error during update..." ), qerror.text() );
}
开发者ID:BackupTheBerlios,项目名称:first4-svn,代码行数:29,代码来源:dataeditfrm.cpp


注:本文中的QSqlError::text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。