Looking for a really basic database example
I've done a little PHP programming before, so I'm at least a little familiar with SQL syntax, but I'm struggling to understand how to use a database with QT. All of the examples I've been able to find have been really complicated and I was hoping that someone could post (or link to) just a really basic example of how to interact with a local database?
For instance, I've tried the following:
Code:
db.setDatabaseName("test.db");
if (db.open())
{
qDebug()<<"\n**** db opened**** :";
qDebug()<<query.exec("create table person (id int primary key, "
"firstname varchar(20), lastname varchar(20))");
}
But the application output is:
Quote:
**** db opened**** :
false
I can't seem to get anything to work..
Thanks for your help :)
Re: Looking for a really basic database example
Make sure that the create table syntax is correct with respect to SQLite.