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
Contributor
Posts: 20
Registered: ‎09-12-2012
My Device: Developer
My Carrier: Docomo

How to use Qt Database Classes in Beta 3

I have used Qt Database classes in Beta 2 but in Beta 3 it was not identifying why is it possible to add Qt Database Classes to our application in Beta3 and create DataBase in our App

Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: How to use Qt Database Classes in Beta 3

Could you be more specific?  I've used Qt's database classes in most of my BB10/Cascades work, and that's one of the few areas of my code that I have not had to make any changes to as I've gone from beta 1 to beta 2 to beta 3.

 

(I'm mostly using QSqlDatabase with its SQLite backend.)

Highlighted
Contributor
Posts: 20
Registered: ‎09-12-2012
My Device: Developer
My Carrier: Docomo

Re: How to use Qt Database Classes in Beta 3

iam currently using beta3 version in that iam using code like this 

 QSqlDatabase *connecor=QSqlDatabase::addDatabase("SQLITE");

but it was raising an exception as like this 

 

Multiple markers at this line
- 'QSqlDatabase' is not a class or
namespace
- 'QSqlDatabase' was not declared in
this scope
- 'connecor' was not declared in this
scope

 

so what i have to do is there any additional configaration?

Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: How to use Qt Database Classes in Beta 3

Well, you do need to include the header file for this stuff at the top of your source file:

 

#include <QtSql/QtSql>

 

Also, the addDatabase() function doesn't return a pointer type, so remove the asterisk.

 

I also suggest adding the connectionName argument to addDatabase(), just in case you plan to use more than one SQLite DB in your app.  It'll prevent conflicts and make your life easier in the future.