📄 frm_edit_sta.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_edit_Sta
Caption = "Form2"
ClientHeight = 6345
ClientLeft = 60
ClientTop = 375
ClientWidth = 6015
LinkTopic = "Form2"
ScaleHeight = 6345
ScaleWidth = 6015
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 450
Left = 1320
Top = 5280
Width = 1935
_ExtentX = 3413
_ExtentY = 794
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame3
Caption = "修改员工信息"
Height = 1215
Left = 360
TabIndex = 13
Top = 3840
Width = 4695
Begin VB.CommandButton Command7
Caption = "退出"
Height = 375
Left = 3240
TabIndex = 16
Top = 600
Width = 1335
End
Begin VB.CommandButton Cmd_del
Caption = "删除记录"
Height = 375
Left = 1800
TabIndex = 15
Top = 600
Width = 1335
End
Begin VB.CommandButton Cmd_modi
Caption = "修改记录"
Height = 375
Left = 240
TabIndex = 14
Top = 600
Width = 1335
End
End
Begin VB.Frame Frame2
Caption = "查看员工信息"
Height = 1095
Left = 240
TabIndex = 8
Top = 2400
Width = 4815
Begin VB.CommandButton Cmd_final
Caption = "最后一条记录"
Height = 375
Left = 3480
TabIndex = 12
Top = 360
Width = 1215
End
Begin VB.CommandButton Cmd_next
Caption = "下一条记录"
Height = 375
Left = 2400
TabIndex = 11
Top = 360
Width = 1095
End
Begin VB.CommandButton Cmd_pre
Caption = "前一条记录"
Height = 375
Left = 1200
TabIndex = 10
Top = 360
Width = 1095
End
Begin VB.CommandButton Cmd_fist
Caption = "第一条记录"
Height = 375
Left = 0
TabIndex = 9
Top = 360
Width = 1095
End
End
Begin VB.Frame Frame1
Height = 2055
Left = 240
TabIndex = 0
Top = 120
Width = 4815
Begin VB.TextBox txtStaff_Id
Height = 270
Left = 1080
TabIndex = 23
Top = 240
Width = 1095
End
Begin VB.TextBox txtStaffphone
Height = 270
Left = 1080
TabIndex = 22
Top = 1560
Width = 1095
End
Begin VB.TextBox txtStafftitle
Height = 270
Left = 3480
TabIndex = 21
Top = 1320
Width = 1095
End
Begin VB.TextBox txtStaffdepart
Height = 270
Left = 1080
TabIndex = 20
Top = 1200
Width = 1095
End
Begin VB.TextBox txtStaffage
Height = 270
Left = 3480
TabIndex = 19
Top = 840
Width = 1095
End
Begin VB.TextBox txtStaffsex
Height = 270
Left = 1080
TabIndex = 18
Top = 720
Width = 1095
End
Begin VB.TextBox txtStaff_Name
Height = 270
Left = 3480
TabIndex = 17
Top = 360
Width = 1095
End
Begin VB.Label Label7
Caption = "电话"
Height = 255
Left = 120
TabIndex = 7
Top = 1560
Width = 615
End
Begin VB.Label Label6
Caption = "职务"
Height = 375
Left = 2640
TabIndex = 6
Top = 1320
Width = 735
End
Begin VB.Label Label5
Caption = "所在部门"
Height = 255
Left = 120
TabIndex = 5
Top = 1200
Width = 855
End
Begin VB.Label Label4
Caption = "年龄"
Height = 255
Left = 2640
TabIndex = 4
Top = 840
Width = 735
End
Begin VB.Label Label3
Caption = "性别"
Height = 255
Left = 120
TabIndex = 3
Top = 720
Width = 735
End
Begin VB.Label Label2
Caption = "员工姓名"
Height = 375
Left = 2640
TabIndex = 2
Top = 360
Width = 735
End
Begin VB.Label Label1
Caption = "员工编号"
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 855
End
End
End
Attribute VB_Name = "Frm_edit_Sta"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_del_Click()
Adodcl.Recordset.Delete
Adodcl.Recordset.Update
MsgBox ("员工记录已删除")
Adodcl.RecordSource = "select * from Staff"
Adodcl.Refresh
End Sub
Private Sub Cmd_final_Click()
Adodcl.Recordset.MoveLast
Cmd_next.Enabled = False
Cmd_pre.Enabled = True
End Sub
Private Sub Cmd_fist_Click()
Adodcl.Recordset.MoveFirst
Cmd_pre.Enabled = False
Cmd_next.Enabled = True
End Sub
Private Sub Cmd_modi_Click()
curId = Adodcl.Recordset.Fields(0)
Adodcl.Recordset.Fields(1) = Val(Trim(txtStaff_Id.Text))
Adodcl.Recordset.Fields(2) = Trim(txtStaff_Name.Text)
Adodcl.Recordset.Fields(3) = Trim(txtStaffSex.Text)
Adodcl.Recordset.Fields(4) = Val(Trim(txtStaffage.Text))
Adodcl.Recordset.Fields(5) = Trim(txtStaffdepart.Text)
Adodcl.Recordset.Fields(6) = Trim(txtStafftitle.Text)
Adodcl.Recordset.Fields(6) = Trim(txtStaffphone.Text)
Adodcl.Recordset.Update
MsgBox ("员工记录已修改")
Adodcl.RecordSource = "select * from Staff"
Adodcl.Refresh
Do While Adodcl.Recordset.Fields(0) <> curId
Adodcl.Recordset.Move (1)
Loop
End Sub
Private Sub Cmd_next_Click()
If Cmd_pre.Enabled = False Then
Cmd_pre.Enabled = True
End If
Adodcl.Recordset.MoveNext
If Adodcl.Recordset.Fields(0) = lastId Then
Cmd_next.Enabled = False
End If
End Sub
Private Sub Cmd_pre_Click()
If Cmd_next.Enabled = False Then
Cmd_next.Enabled = True
End If
Adodcl.Recordset.MovePrevious
If Adodcl.Recordset.Fields(0) = firstId Then
Cmd_pre.Enabled = False
End If
End Sub
Private Sub Form_Load()
Adodcl.RecordSource = "select * from Staff"
Adodcl.Refresh
If Adodcl.Recordset.RecordCount <> 0 Then
Adodcl.Recordset.MoveLast
lastId = Adodcl.Recordset.Fields(0)
Adodcl.Recordset.MoveFirst
firstId = Adodcl.Recordset.Fields(0)
End If
Cmd_pre.Enabled = False
If Adodcl.Recordset.RecordCount <> 1 Then
Cmd_next.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -