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
Posts: 238
Registered: ‎12-26-2010
My Device: BlackBerry Z10
My Carrier: Telus
Accepted Solution

Database Query Error

QFile databaseFile(QDir::home().absoluteFilePath("testDatabase.db"));

//open the database file
if(databaseFile.open(QIODevice::ReadWrite))
{
	 sda=new SqlDataAccess(QDir::home().absoluteFilePath("testDatabase.db"),this);
sda->execute("CREATE TABLE Persons" "(" "_id INTEGER PRIMARY KEY AUTOINCREMENT," "name TEXT NOT NULL UNIQUE," "status TEXT NOT NULL," ")"); } if(sda->hasError())// THIS ALWAYS RETURNS TRUE { showDialog("","error"); }

 Hi, I initialize my database when my app run for the first time, and the SqlDataAccess.hasError(); returns True.

 

Is there any obvious mistake i am doing here?

 

Thanksss

www.jackdevora.com
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Database Query Error

[ Edited ]

[edit] wrong assumption, easy to miss those trailing commas :smileyhappy: 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 238
Registered: ‎12-26-2010
My Device: BlackBerry Z10
My Carrier: Telus

Re: Database Query Error

Ahh, found it the little coma at the end of the sql statement
www.jackdevora.com