Results 1 to 2 of 2

Thread: strange error in QSqlQuery::bindValue

  1. #1

    Default Re: strange error in QSqlQuery::bindValue

    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:n_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 = ersonalNumber, "
    "educationalIsstitution = :educationalIsstitution, "
    "typeOfEducation = :typeOfEducation, "
    "typeOfTraining = :typeOfTraining, "
    "specialty = :specialty, "
    "qualification = :qualification ;"
    ) ;
    query.bindValue( ":numberOfDiploma", ui->tableWidget_2->item( i, 0 )->text() ) ;
    query.bindValue( "ersonalNumber", 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.
    Last edited by Jean Sommeil; 29th May 2013 at 10:54.

  2. #2

    Default Re: strange error in QSqlQuery::bindValue

    Don't know how, but it's solved. Probably it was something wrong with reading from table. But I don't know what exactly.
    Last edited by Jean Sommeil; 29th May 2013 at 16:21.

Similar Threads

  1. QSqlQuery::bindValue does not work
    By l0ud in forum Newbie
    Replies: 3
    Last Post: 23rd September 2012, 22:42
  2. QSqlQuery bindValue and SELECT WHERE IN
    By helloworld in forum Qt Programming
    Replies: 5
    Last Post: 6th November 2010, 15:45
  3. QSqlQuery::bindValue
    By viglu in forum Newbie
    Replies: 3
    Last Post: 29th March 2010, 20:13
  4. QSqlQuery::bindValue() Question
    By kandalf in forum Qt Programming
    Replies: 7
    Last Post: 30th January 2010, 12:14
  5. Starnge error while painting
    By nish in forum Qt Programming
    Replies: 1
    Last Post: 13th March 2008, 23:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.