Newbie having trouble creating a database here. Following code compiles ok, but no database is created and I can't find any sqlite file.
#include "makeDB.h"
#include <iostream>
#include <QString>
#include <QtSql>
void makeDB(QString dbName) {
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setHostName("localHost");
db.setDatabaseName(dbName);
db.setUserName("logger");
db.setPassword("logger");
}
#include <QtGui/QApplication>
#include <QString>
#include <QtSql>
#include "mainwindow.h"
#include "makeDB.h"
#include "createTable.h"
#include "ui_mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
makeDB("log1");
createTable();
return a.exec();
}
What am I doing wrong here? Thanks! Waynew Edit/Delete Message