PDA

View Full Version : Query - how to store ?



damodharan
31st May 2010, 08:41
Dear all,

i am using Qt in Symbian .

QSqlQuery query;
query.prepare(QString("select Number,Enable from FilterNumTable where Enable = '1'"));

it will show like this

Number Enable
------ ------
12345 1
12346 1
12347 1

how can i store the Number in to < Array or QList >
how to store?
any one have idea about this?

Lykurg
31st May 2010, 09:55
QList<int> list;
QSqlQuery query("select Number from FilterNumTable where Enable = '1'");
while (query.next())
list << query.value(0).toInt();

You don't have to get Enable since you know that it is 1. And is Enable really a string?

damodharan
31st May 2010, 12:59
QList<int> list;
QSqlQuery query("select Number from FilterNumTable where Enable = '1'");
while (query.next())
list << query.value(0).toInt();

You don't have to get Enable since you know that it is 1. And is Enable really a string?

thx for u r reply Lykurg