Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
noahhuang
Posts: 100
Registered: ‎10-01-2012
My Device: BB10 Dev Alpha
My Carrier: Roger
Accepted Solution

how to get a column value from sql query?

Hi, has anyone know how to get a column's value from sql query? 

Here is my code, the value should be 1350079224397 in my db, but I get 0 

 

QString query("SELECT version FROM db_version");

QVariant result = sda.execute(query);
QVariantMap versionMap = result.toList().first().toMap();
if(!versionMap.isEmpty())
{
qDebug()<<"Version: " <<versionMap.value("version").toLongLong();
}

Please use plain text.
Developer
noahhuang
Posts: 100
Registered: ‎10-01-2012
My Device: BB10 Dev Alpha
My Carrier: Roger

Re: how to get a column value from sql query?

ok, I find the solution

 

 QString query("SELECT version as version FROM db_version");

Please use plain text.