Charset problem with SQLDatabase in QT Creator 2.8.1 ( QT 5.1.1)



  • Hey guys, I read Values from a *.mdb Databse and they are shown as ?? symbols :(
    Even using qDebug << "output" ... I get "?" symbols, but if I show the database in MS Access, it looks normal.

    Encoding problem, right ? so How do I fix that ?

    C++ Code I use to read:
    @QSqlDatabase mgDb = QSqlDatabase::addDatabase("QODBC");
    QSqlQuery query;
    // Open connection.
    mgDb.setHostName("localhost");
    mgDb.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=file://../Daten/Datenbank1.mdb");

    if(mgDb.open() == false){
      qDebug() << "ODBC::open() : error opening connection : "
         << mgDb.lastError().text() << "\n";
    }
    QStringList list = mgDb.tables(QSql::Tables);
    for(int i=0;i<list.size(); ++i){
      qDebug() << "Table names " << list.at(i) << endl;
    }
    QSqlDriver const * driver = query.driver();
    QSqlRecord rec = driver->record("EntityTypeTbl");
    query.prepare(QObject::trUtf8("SELECT * FROM Kurse"));
    query.exec&#40;&#41;;@


  • does nobody know ? :/


Log in to reply
 

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