[Qt-interest] mysql select query returns null
berkan kısaoğlu
berkankisaoglu at gmail.com
Tue Aug 11 09:34:56 CEST 2009
Sorry for replying my own post,
i have mysql server 5.0.45 running on windows mechine..
on linux host, i have no problem.. thanks ^^
2009/8/11 berkan kısaoğlu <berkankisaoglu at gmail.com>
> hey all,
> i need a fast reply, because i am at the deadline..
>
> i have a code,
>
> "
> QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
>
> db.setHostName(strlist[0]);
>
> db.setDatabaseName(strlist[1]);
>
> db.setUserName(strlist[2]);
>
> db.setPassword(strlist[3]);
>
> bool ok = db.open();
>
>
> if(ok){
>
> QSqlDatabase defaultDB = QSqlDatabase::database();
>
> setupUi(this); // this sets up GUI
>
> QSqlQuery q;
>
> q.exec("SELECT gen_name,gen_id FROM project_general WHERE
> gen_last='1'");
>
> QStringList strlist;
>
> strlist<<"";
>
> while(q.next()){ strlist<<q.value(1).toString()+ " / " +
> q.value(0).toString(); }
>
> "
> but it query returns null.. (!)
> but i can make insert operation, i have a connection that is established,
>
> my question is why i can not execute select queries?
>
> thanks in advice
>
>
--
berkan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090811/e529fcfe/attachment.html
More information about the Qt-interest-old
mailing list