当前位置:网站首页>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();
}
边栏推荐
- [learn C and fly] 2day Chapter 8 pointer (practice 8.1 password unlocking)
- 大厂裁员潮不断,双非本科出身的我却逆风翻盘挺进阿里
- Opengauss database backup and recovery guide
- OpenCASCADE7.6编译
- What are the necessary things for students to start school? Ranking list of Bluetooth headsets with good sound quality
- Vsocde has cli every time it is opened js
- 2022安全员-C证考试题及模拟考试
- Sword finger offer 62 The last remaining number in the circle
- 离婚3年以发现尚未分割的共同财产,还可以要么
- Which kind of sports headphones is easier to use? The most recommended sports headphones
猜你喜欢

Infix expression to suffix expression (computer) code

AR增强现实可应用的场景

leetcode373. 查找和最小的 K 对数字(中等)

JVM面试篇

The basic steps of using information theory to deal with scientific problems are

Opencascade7.6 compilation

WebGPU(一):基本概念
![[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)](/img/8e/a86a9724251718d98ce172a6a96e53.png)
[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)

Feature query of hypergraph iserver rest Service

Decipher the AI black technology behind sports: figure skating action recognition, multi-mode video classification and wonderful clip editing
随机推荐
Comparative analysis of MVC, MVP and MVVM, source code analysis
[technology development -21]: rapid overview of the application and development of network and communication technology -1- Internet Network Technology
CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
What kind of good and cost-effective Bluetooth sports headset to buy
Software testing learning notes - network knowledge
[deep learning] Infomap face clustering facecluster
Cesium dynamic diffusion point effect
Opengauss database backup and recovery guide
JVM面试篇
leetcode2310. 个位数字为 K 的整数之和(中等,周赛)
STM32F103 - two circuit PWM control motor
Additional: information desensitization;
[learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)
[opencv] - comprehensive examples of five image filters
essay structure
Pytest testing framework
花一个星期时间呕心沥血整理出高频软件测试/自动化测试面试题和答案
Sword finger offer 31 Stack push in and pop-up sequence
研发中台拆分过程的一些心得总结
pytest 测试框架