C++ (Qt)QSqlDatabase db;db = QSqlDatabase::addDatabase("QMYSQL");db.setHostName(serverIP); db.setDatabaseName("baza"); db.setPort(3306); db.setUserName("tester"); db.setPassword("pass"); if (db.open()){ dataModel->select();}else{ qCritical() << "Cannot open database:" << db.lastError().text().toAscii();}
C++ (Qt)dataModel->setEditStrategy(QSqlTableModel::OnFieldChange);dataModel->setTable("Channel");dataModel->select();
C++ (Qt)delete dataModel;dataModel = new QSqlTableModel(parent);...