Jean Sommeil
29th May 2013, 10:54
Hi, guys. I have strange problem.
I launch my program and, when i press pushButton_5, she always crashes at the point with comment. What it can be? Have you any ideas?
void addinfo::on_pushButton_5_clicked()
{
QSqlDatabase db = QSqlDatabase::database("mydb");
QSqlQuery query(db) ;
- - - -- - - -- - - - -- - - - - - -- - -- - - - -- -- - - -- - - - - -- - - - -
for ( int i = 0; i < ui->tableWidget_2->rowCount() - 1; i++ )
{
query.prepare( "REPLASE educationData SET "
"numberOfDiploma = :numberOfDiploma, "
"personalNumber = :personalNumber, "
"educationalIsstitution = :educationalIsstitution, "
"typeOfEducation = :typeOfEducation, "
"typeOfTraining = :typeOfTraining, "
"specialty = :specialty, "
"qualification = :qualification ;"
) ;
query.bindValue( ":numberOfDiploma", ui->tableWidget_2->item( i, 0 )->text() ) ;
query.bindValue( ":personalNumber", ui->lineEdit->text() ) ;
query.bindValue( ":educationalIsstitution", ui->tableWidget_2->item( i, 1 )->text() ) ;
query.bindValue( ":typeOfEducation", ui->tableWidget_2->item( i, 2 )->text() ) ;
query.bindValue( ":typeOfTraining", ui->tableWidget_2->item( i, 3 )->text() ) ;
query.bindValue( ":specialty", ui->tableWidget_2->item( i, 4 )->text() ) ;
//program crashes somewhere after this point
query.bindValue( ":qualification", ui->tableWidget_2->item( i, 5 )->text() ) ;
//and somewhere before this point
query.exec() ;
qDebug() << "token";
query.clear();
}
tableWidget:
ui->tableWidget_2->setRowCount(1);
ui->tableWidget_2->setColumnCount(6);
Added after 51 minutes:
I corrected a stupid mistake in sql command, but program still crashes. Something wrong in:
ui->tableWidget_2->item( i, 5 )->text()
Without this all is fine. Please help. I haven't any ideas what it can be.
I launch my program and, when i press pushButton_5, she always crashes at the point with comment. What it can be? Have you any ideas?
void addinfo::on_pushButton_5_clicked()
{
QSqlDatabase db = QSqlDatabase::database("mydb");
QSqlQuery query(db) ;
- - - -- - - -- - - - -- - - - - - -- - -- - - - -- -- - - -- - - - - -- - - - -
for ( int i = 0; i < ui->tableWidget_2->rowCount() - 1; i++ )
{
query.prepare( "REPLASE educationData SET "
"numberOfDiploma = :numberOfDiploma, "
"personalNumber = :personalNumber, "
"educationalIsstitution = :educationalIsstitution, "
"typeOfEducation = :typeOfEducation, "
"typeOfTraining = :typeOfTraining, "
"specialty = :specialty, "
"qualification = :qualification ;"
) ;
query.bindValue( ":numberOfDiploma", ui->tableWidget_2->item( i, 0 )->text() ) ;
query.bindValue( ":personalNumber", ui->lineEdit->text() ) ;
query.bindValue( ":educationalIsstitution", ui->tableWidget_2->item( i, 1 )->text() ) ;
query.bindValue( ":typeOfEducation", ui->tableWidget_2->item( i, 2 )->text() ) ;
query.bindValue( ":typeOfTraining", ui->tableWidget_2->item( i, 3 )->text() ) ;
query.bindValue( ":specialty", ui->tableWidget_2->item( i, 4 )->text() ) ;
//program crashes somewhere after this point
query.bindValue( ":qualification", ui->tableWidget_2->item( i, 5 )->text() ) ;
//and somewhere before this point
query.exec() ;
qDebug() << "token";
query.clear();
}
tableWidget:
ui->tableWidget_2->setRowCount(1);
ui->tableWidget_2->setColumnCount(6);
Added after 51 minutes:
I corrected a stupid mistake in sql command, but program still crashes. Something wrong in:
ui->tableWidget_2->item( i, 5 )->text()
Without this all is fine. Please help. I haven't any ideas what it can be.