Skip to content

Instantly share code, notes, and snippets.

View dpeytonX's full-sized avatar

dpeytonX

  • North Carolina, United States
View GitHub Profile
@allyusd
allyusd / sql.cpp
Last active November 13, 2024 14:31
Qt PostgreSQL Example
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\"");