Quantcast
Channel: Qt DevNet forums: Installation and Deployment
Viewing all articles
Browse latest Browse all 2113

Can't connect to SQLite DB

$
0
0
Doing my first steps in Qt Creator and lost already: To a basic, otherwise unchanged starting app from the Qt wizzard, I have added `sql` to the project file     QT       += core gui sql and the lines below to `mainwindow.cpp`.     #include <QSqlDatabase>         QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");     db.setDatabaseName("/home/vaettchen/testSQL/myDB.sqlite");     bool db_ok = db.open(); According to various sources here on the Qt WebSite and on StackOverflow (where nobody could help me), I had expected that this would do it. But I get a compiler error ../testSQL/mainwindow.cpp:20:1: error: 'db' does not name a type where line 20 is the db.setDataBaseName() line. I have tried to find out via Google what this means and what can be done about it but the comments I found were not very useful. Using Qt Creator 2.7.0 (Qt 4.8.4) on Linux 3.5

Viewing all articles
Browse latest Browse all 2113

Trending Articles