9 Star 50 Fork 25

酷玩蚊仔/按键精灵脚本

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
连接MySQL.Q 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
酷玩蚊仔 提交于 2023-06-23 16:53 +08:00 . 连接MySQL
[General]
SyntaxVersion=2
BeginHotkey=121
BeginHotkeyMod=0
PauseHotkey=0
PauseHotkeyMod=0
StopHotkey=123
StopHotkeyMod=0
RunOnce=1
EnableWindow=
MacroID=b5e29d29-aa9e-4a29-9419-cbc8fd7dd3fc
Description=连接MySQL
Enable=1
AutoRun=0
[Repeat]
Type=0
Number=1
[SetupUI]
Type=2
QUI=
[Relative]
SetupOCXFile=
[Comment]
[Script]
Set connection = CreateObject("ADODB.Connection")
//connection.Open "DSN=Mysql;UID=root;PWD=123456;PORT=3306;DATABASE=testdb;Data Source=localhost"
connection.Open "Provider=MSDASQL.1;Password=123456;Persist Security Info=True;User ID=root;Data Source=localhost;Initial Catalog=testdb"
Set recordset = CreateObject("ADODB.Recordset")
connection.BeginTrans
SQL1 = "DELETE FROM items WHERE id = 1"
connection.Execute SQL1, resLength1
TracePrint resLength1
SQL2 = "UPDATE items SET name = '龙纹剑', price = 777 WHERE id = 2"
connection.Execute SQL2, resLength2
TracePrint resLength2
SQL3 = "INSERT INTO items(name, price) VALUES('屠龙刀', '999')"
connection.Execute SQL3, resLength3
TracePrint resLength3
TracePrint connection.Errors.Count
If connection.Errors.Count > 0 Then
connection.RollbackTrans
Else
connection.CommitTrans
End If
SQL = "SELECT * FROM items"
recordset.open SQL, connection, 1
If recordset.bof And recordset.eof Then
TracePrint "没有记录"
Else
While not recordset.eof
TracePrint recordset("id") & " " & recordset("name") & " " & recordset("price")
recordset.movenext
Wend
End If
recordset.close
connection.close
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kuwwz/QScript.git
git@gitee.com:kuwwz/QScript.git
kuwwz
QScript
按键精灵脚本
master

搜索帮助