当前位置:网站首页>QT uses sqllite
QT uses sqllite
2022-07-02 02:28:00 【NLeRnotfalled】
sql.pro Inside the directory , Join in sql Support for
QT += core gui
QT += sql
To prevent generation to debug file , Need to be in database Join in …/+“ Your project catalog ”/ Operator of database name , bring .db The file is generated in your project directory
#include "mainwindow.h"
#include <QApplication>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("../sql/test.db");
db.open();
QString path = QCoreApplication::applicationDirPath();
qDebug()<<path;
QSqlQuery query;
query.exec("CREATE TABLE student(id INT PRIMARY KEY, username VARCHAR(30),pwd VARCHAR(30))");
MainWindow w;
w.show();
qDebug()<<QSqlDatabase::drivers();
return a.exec();
}
边栏推荐
- DNS domain name resolution
- A quick understanding of digital electricity
- * and & symbols in C language
- Open那啥的搭建文档
- MySQL主从延迟问题怎么解决
- CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
- Oracle creates a user with read-only permission in four simple steps
- Mathematics in Sinorgchem: computational geometry
- A quick understanding of analog electricity
- 剑指 Offer II 031. 最近最少使用缓存
猜你喜欢

How to build and use redis environment

【OpenCV】-5种图像滤波的综合示例

Webgpu (I): basic concepts

JVM interview

CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes

leetcode2312. 卖木头块(困难,周赛)

How to execute an SQL in MySQL

Decipher the AI black technology behind sports: figure skating action recognition, multi-mode video classification and wonderful clip editing

Leetcode face T10 (1-9) array, ByteDance interview sharing

超图iServer rest服务之feature查询
随机推荐
[reading notes] programmer training manual - practical learning is the most effective (project driven)
超图iServer rest服务之feature查询
LFM signal denoising, time-frequency analysis, filtering
leetcode2310. 个位数字为 K 的整数之和(中等,周赛)
Leetcode face T10 (1-9) array, ByteDance interview sharing
Duplicate keys detected: ‘0‘. This may cause an update error. found in
An analysis of circuit for quick understanding
Use the open source project [banner] to achieve the effect of rotating pictures (with dots)
flutter 中間一個元素,最右邊一個元素
The basic steps of using information theory to deal with scientific problems are
If you want to rewind the video picture, what simple methods can you use?
Which brand of running headphones is good? How many professional running headphones are recommended
LeetCode刷题(十)——顺序刷题46至50
[pit] how to understand "parameter fishing"
CSDN insertion directory in 1 second
剑指 Offer 29. 顺时针打印矩阵
What is the function of the headphone driver
How to solve MySQL master-slave delay problem
Summary of some experiences in the process of R & D platform splitting
Which is a good Bluetooth headset of about 300? 2022 high cost performance Bluetooth headset inventory