[Qt-interest] QtSql and boundValue() for SELECT results
Michal Ludvig
mludvig at logix.net.nz
Fri Jul 3 05:14:37 CEST 2009
Hi,
what's the way to use QtQuery.boundValue(':placeholder') for SELECT
statements? I can't find an example and failed to work it out myself too.
I tried something like:
QVariant xyz;
query.prepare("SELECT xyz AS :xyz FROM table WHERE blah=blah");
query.bindValue(":xyz", xyz, Qt::Out);
query.exec();
while (query.next()) {
xyz = query.boundValue(':xyz');
...
}
but it didn't work.
I fell back to using query.value(0), query.value(1), ... but don't quite
like this method. I'd prefer to refer to the fields in the resultset by
name instead of by position.
Does anybody know how to arrange this?
Thanks!
Michal
More information about the Qt-interest-old
mailing list