📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1410
ClientLeft = 60
ClientTop = 450
ClientWidth = 3630
LinkTopic = "Form1"
ScaleHeight = 1410
ScaleWidth = 3630
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "调整工资"
Height = 375
Left = 480
TabIndex = 0
Top = 480
Width = 2655
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Conn As New ADODB.Connection
Private Sub Form_Load()
Dim Connstring As String
Connstring = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & App.Path & "\教学.mdb"
With Conn
.ConnectionString = Connstring
.ConnectionTimeout = 10
.Open '给连接的ConnectionString属性赋值,然后使用求带参数的Open方法打开连接
End With
End Sub
Private Sub Command1_Click()
Conn.BeginTrans '开始事务处理
Conn.Execute "Update 教师表 set 工资 =工资*(1+0.1)"
If MsgBox("保存所作的工资调整吗?", vbQuestion + vbYesNo) = vbYes Then
Conn.CommitTrans '提交事务
Else
Conn.RollbackTrans '撤消事务
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -