BUG in MYSQL Plugin



  • Hi everyone,
    I'm tryinig to execute the following SQL query:

    QSqlQuery query;

    @
    query.prepare("INSERT INTO osoby (idosoby, Imie, Nazwisko, DataUrodzenia) "
    "VALUES (?, ?, ?, ?)");
    QString data=this->dataUrodzenia.toString();
    query.bindValue(0,999);
    query.bindValue(1,this->imie);
    query.bindValue(2,this->nazwisko);
    query.bindValue(3,this->dataUrodzenia.toString());
    query.exec();
    @

    Correct name of table is "osoby" if i type this name in query,this doesnt execute.
    If i type a name of table that doesnt exist query will execute.

    [edit: added missing coding tags @ SGaist]



  • If
    @query.exec(); @

    return false, Check what return:

    @query.lastError().text();@



  • Both queries return no errors.
    "INSERT INTO osoby (idosoby, Imie, Nazwisko, DataUrodzenia) VALUES (?, ?, ?, ?)"

    "INSERT INTO osoby1 (idosoby, Imie, Nazwisko, DataUrodzenia) VALUES (119, 'dsf', 'dsf', 'So sty 1 2000')"



  • I found the solution.I changed the following 2 line commands:
    QSqlQuery query; query.prepare(“INSERT INTO osuob (idosoby, Imie, ########) “ “VALUES (?, ?, ?)”);
    to this one:

    QSqlQuery query(“INSERT INTO osoby (Imie, ########, DataUrodzenia) “ “VALUES (?, ?, ?)”);
    Thanks for help


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.