Files
Obsidian/QT/第十七章.md
2025-08-23 15:15:57 +08:00

31 lines
861 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

![[第17章(2课时已更新.ppt]]
第17章重点qt连接数据库的使用。
安装完mysql在odbc配置数据源。
![[92f8bd976d775f7a9b67c3c6954238f.png]]
将lib和dll文件从mysql安装目录找到复制到qt的安装目录下。
![[8d3b90f415b25cbefd48f544124e91d.png]]
![[4ece700f456523e757d44c56c6d11d2.png]]
![[325df8980ecb953d6b11a42310eb2ae 1.png]]
![[68834c79fd94cac9456844aabdb91e2.png]]
常用的一些sql语句
#创建数据库
create database db_name;
#使用数据库,也就是指定当前数据库。
use db_name;
#创建表
create table tb_name (
id int auto_increment primary key,
name varchar(20)
);
#插入数据
insert into tb_name (id, name) values (1,zhao);
#更新数据
update tb_name set name = qian where id = 1;
#删除数据
delete from tb_name where id = 1;
#删除表
drop table tb_name;