#include "testbd.h"#include "QSqlDatabase"#include "QSqlError"#include "QtSql"TestBD::TestBD(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags){ ui.setupUi(this); QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE"); db.setHostName("bigblue"); db.setDatabaseName("flightdb"); db.setUserName("acarlson"); db.setPassword("1uTbSbAs"); bool ok = db.open(); if(!ok) { QString str = db.lastError().text(); }}
C++ (Qt).... QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");....
TestBD::TestBD(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags){ ui.setupUi(this); QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE"); //db.setHostName("bigblue"); db.setDatabaseName("d:\myDB.gdb"); db.setUserName("SYSDBA"); db.setPassword("masterkey"); bool ok = db.open(); if(!ok) { QString str = db.lastError().text(); }}