Last active
February 20, 2022 18:49
-
-
Save allyusd/3b57b8d2baf3b64190f1 to your computer and use it in GitHub Desktop.
Qt PostgreSQL Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL"); | |
db.setHostName("127.0.0.1"); | |
db.setDatabaseName("FirstDB"); | |
db.setUserName("demo"); | |
db.setPassword("password"); | |
bool ok = db.open(); | |
if (ok) | |
{ | |
QSqlQuery query("SELECT \"SID\", \"Account\", \"CreateDate\", \"LoginTimes\" FROM \"Account\""); | |
while (query.next()) | |
{ | |
qWarning() << query.value(0).toString(); | |
qWarning() << query.value(1).toString(); | |
qWarning() << query.value(2).toString(); | |
qWarning() << query.value(3).toString(); | |
} | |
qDebug() << query.lastError().text(); | |
} |
If you are intersted in Qt and PostgreSQL Database you can download Sohag Developer. ...
That web site you linked to fills the web page with Chinese advertisements for pornography.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are intersted in Qt and PostgreSQL Database you can download Sohag Developer. It will help you developing Qt Database applications fast for more information visit ******
Or you can download it from ******
2020-09-21 Update: remove the link, web site maybe is https://sohagdeveloper.com/