当前位置:网站首页>[QT] Chapter 10: Database
[QT] Chapter 10: Database
2022-06-23 18:29:00 【Yadong classmate】
Chapter ten : database
- The main :
Create connection : Will create a QSqIDatabase class Example , Only a call open() Function before the connection can be used .
QSqlQuery class An interface is provided , Used to perform SQL Statement and browse the result set of the query . To execute a SQL sentence , You simply create one QSqlQuery object , And then call QSqlQuery : : ex-ec() Function , for example :
QSqlQuery query;
query.exec( "select * from student");
- QTSQL modular :

Can pass QSqIDatabase::drivers() Method to get the current sql Which databases are supported in the module . - When creating multiple connections , Connection name should be specified , Can't default
QSqlDatabase db1 = QSqIDatabase::addDatabase("QSQLITE",connect1);
QSqlDatabase db2 = QSqlDatabase::addDatabase("QSQLITE",connect2);
Query result set :
seek(int n) : query Point to the second part of the result set n Bar record . Specify the current location
first() : query The first record pointing to the result set .
last() : query Points to the last record in the result set .
next() : query Point to the next record , Every time the function is executed , It points to the next adjacent record .previous(): Point to previous record , Every time the function is executed , It points to the next record .record(): Get the record you are pointing to .
value(int n): Get the value of the property . among n Represents the second page of your query n Attributes
query.at():l obtain query The number of the record in the result set query.record().indexOf(“name”):ll return "name" The column number of
query.record().count():l Get the attributes in each record ( Namely column ) The number of
Record.field(n):ll Get the current record's n A field
- The core :
increase Delete check Change
边栏推荐
- [unity] instructions for beginners of textanimator plug-in
- 【Unity】插件TextAnimator 新手使用说明
- 云原生行业应用崛起,从“可用”到“好用”有多远?
- Shell脚本编写
- 一元二次方程到规范场
- 2021 excellent TDP members' output data summary is coming, come and watch!!!
- Reading papers (51):integration of a holonic organizational control architecture and multiobjective
- Remote connection raspberry pie in VNC Viewer Mode
- 实现领域驱动设计 - 使用ABP框架 - 通用准则
- Dive Into Deep Learning——1、前言
猜你喜欢

leetcode刷题:哈希表01 (有效的字母异位词)

Deep understanding of padding

基于FPGA的电磁超声脉冲压缩检测系统 论文+源文件

【Unity】插件TextAnimator 新手使用说明

Paper reading (47):dtfd-mil: double tier feature interpretation multiple instance learning for histopathology

提高效率 Or 增加成本,开发人员应如何理解结对编程?

基于QT实现的图形学绘制系统 文档+项目源码及可执行EXE文件+系统使用说明书

Redis Cluster

Landing of global organizational structure control

聊一聊数据库的行存与列存
随机推荐
leetcode刷题:哈希表01 (有效的字母异位词)
2021 excellent TDP members' output data summary is coming, come and watch!!!
实用电路分析3
用软件可编程FPGA加速网络边缘的移动应用总结
Remote connection raspberry pie in VNC Viewer Mode
一,数组--滑动窗口问题--长度最小的子数组--水果成篮问题
论文阅读 (47):DTFD-MIL: Double-Tier Feature Distillation Multiple Instance Learning for Histopathology..
Redis 集群
实现领域驱动设计 - 使用ABP框架 - 通用准则
3000帧动画图解MySQL为什么需要binlog、redo log和undo log
Wiley-中国科学院文献情报中心开放科学联合研讨会第二讲:开放获取期刊选择及论文投稿...
Paper reading (54):deepfool: a simple and accurate method to four deep neural networks
[failure announcement] there is a problem with the redis that replaces memcached, causing the website to fail
芯片原厂必学技术之理论篇(4-1)时钟技术、复位技术
【 Huazhong University of Science and technology】 Data Sharing for retest of the initial Examination
基于QT实现的图形学绘制系统 文档+项目源码及可执行EXE文件+系统使用说明书
yapi安装
Sword finger offer II 092 Flip character / Sword finger offer II 093 Longest Fibonacci sequence
【剑指Offer】46. 把数字翻译成字符串
论文阅读 (49):Big Data Security and Privacy Protection (科普文)