QODBC, cannot get data ..???

GK gk_ulm at web.de
Wed Jun 1 12:41:53 BST 2005


Hallo,

I wanted to start with qt-sql-programming and I'm trying a very simple 
first example.
Connecting to the db via ODBC works nice, executing a "select-"query 
works also, but I cannot receive data.


code:
....
if ( defaultDB->open() ) {
QSqlQuery query = defaultDB->exec( "SELECT id, name FROM company");
qDebug("no. of affected rows: %d, isValid ? %d, isActive ? %d", 
query.numRowsAffected(), query.isValid(), query.isActive());
if ( query.isActive() ) {
    query.first();
    qDebug("query is active, at: %d", query.at());
    while ( query.next() ) {
      qDebug("ID:%d, name:%s",query.value(0), query.value(1) );

    }
}

}
....

=> after the exec-call the query is in this state:
   isActive=true, isValid=false, numRowsAffected=5070

=> after navigating to the first result-set via .first():
   isValid=false, at=-1


What goes wrong there ??




thanks in advance.....GERD....
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gk_ulm.vcf
Type: text/x-vcard
Size: 156 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20050601/e0949bd3/attachment.vcf>


More information about the KDevelop mailing list