Hello everybody,
I have connected 2 database for the program,
db.setHostName("10.0.0.11");
db.setPort(5432);
db.setDatabaseName(comboDonem->currentText());
db.setUserName(lineKullanici->text());
db.setPassword(lineSifre->text());
db = QSqlDatabase::addDatabase("QPSQL");
db.setHostName("10.0.0.11");
db.setPort(5432);
db.setDatabaseName(comboDonem->currentText());
db.setUserName(lineKullanici->text());
db.setPassword(lineSifre->text());
To copy to clipboard, switch view to plain text mode
and the other one is
cachedb
= QSqlDatabase::addDatabase("QSQLITE",
"in_mem_db");
cachedb.setDatabaseName(":memory:");
if (!cachedb.open())
{
QMessageBox::warning(this, tr
("Unable to open database"), tr
("An error occured while opening the connection: ") + cachedb.
lastError().
text());
return false;
}
QSqlDatabase::database("in_mem_db", false).close();
QSqlDatabase::removeDatabase("in_mem_db");
cachedb = QSqlDatabase::addDatabase("QSQLITE", "in_mem_db");
cachedb.setDatabaseName(":memory:");
if (!cachedb.open())
{
QMessageBox::warning(this, tr("Unable to open database"), tr("An error occured while opening the connection: ") + cachedb.lastError().text());
return false;
}
To copy to clipboard, switch view to plain text mode
I could load the cache and select from cache. But the problem I have is when I go to another page(another .h file), I could not connect to cache. I could only connect db. (PQSQL)
I want to know How could I connect the cache and select from there.
Bookmarks