📄 updatepform.frm
字号:
VERSION 5.00
Begin VB.Form UpdatePForm
Caption = "修改职位"
ClientHeight = 3645
ClientLeft = 6375
ClientTop = 5835
ClientWidth = 4260
LinkTopic = "Form1"
ScaleHeight = 3645
ScaleWidth = 4260
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 2280
TabIndex = 7
Top = 3000
Width = 1095
End
Begin VB.CommandButton cmdModify
Caption = "修改"
Height = 375
Left = 720
TabIndex = 6
Top = 3000
Width = 1095
End
Begin VB.TextBox txtValue
Height = 375
Index = 2
Left = 1560
TabIndex = 5
Top = 1520
Width = 2415
End
Begin VB.TextBox txtValue
Height = 375
Index = 1
Left = 1560
TabIndex = 3
Top = 820
Width = 2415
End
Begin VB.TextBox txtValue
Height = 375
Index = 0
Left = 1560
TabIndex = 1
Top = 120
Width = 2415
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 2
Left = 360
TabIndex = 4
Top = 1605
Width = 855
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 1
Left = 360
TabIndex = 2
Top = 915
Width = 855
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 0
Left = 360
TabIndex = 0
Top = 240
Width = 855
End
End
Attribute VB_Name = "UpdatePForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'退出窗口
Private Sub cmdCancel_Click()
Me.Hide
End Sub
'修改职位
Private Sub cmdModify_Click()
'打开错误处理陷阱
Dim intErrFileNo As Integer '自由文件号
On Error GoTo ErrGoto
'----------------------------------------------------
'生成SQL语句
SQL = "UPDATE 职位 SET" & _
" 职位 = """ & txtValue(0).Text & """," & _
" 基本工资 = " & txtValue(1).Text & ", " & _
" 津贴 = " & txtValue(2).Text & ", " & _
" 奖金 = " & txtValue(3).Text & _
" WHERE 职位=""" & txtValue(0).Text & """"
'打开数据连接
OpenDBFile
'执行SQL
gCon.Execute SQL
'关闭连接
CloseDBFile
Me.Hide
'刷新数据
PosForm.Adodc1.Refresh
'----------------------------------------------------
Exit Sub
'-----------------------------
ErrGoto:
'把错误信息保存在文件里
intErrFileNo = FreeFile()
Open "YFSystem.ini" For Append As intErrFileNo
Print #intErrFileNo, Chr(34) + Format(Now, "YYYY-MM-DD HH:MM:SS") + Chr(34), Chr(34) + "信息" + Chr(34), Chr(34) + Err.Description + Chr(34), Chr(34) + "Command1_Click(AddEForm)" + Chr(34), Chr(34) + App.Title + Chr(34)
Print #intErrFileNo, Err.Description
Close #intErrFileNo
End Sub
'窗体初始显示
Private Sub Form_activate()
lblField(0).Caption = "职位"
lblField(1).Caption = "基本工资"
lblField(2).Caption = "津贴"
For i = 0 To 2
PosForm.DataGrid1.Row = PosForm.CurPos
PosForm.DataGrid1.Col = i
txtValue(i) = PosForm.DataGrid1.Text
Next
txtValue(0).Locked = True
txtValue(0).Text = PosForm.CurPos
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -