?? frm_yggl.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Frm_yggl
BorderStyle = 1 'Fixed Single
Caption = "員工信息管理"
ClientHeight = 4545
ClientLeft = 45
ClientTop = 435
ClientWidth = 7575
LinkTopic = "Form2"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4545
ScaleWidth = 7575
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmd_save
Caption = "保存"
Enabled = 0 'False
Height = 375
Left = 6600
TabIndex = 22
Top = 4080
Width = 855
End
Begin VB.CommandButton cmd_edit
Caption = "修改"
Enabled = 0 'False
Height = 375
Left = 5760
TabIndex = 21
Top = 4080
Width = 855
End
Begin VB.CommandButton cmd_del
Caption = "刪除"
Enabled = 0 'False
Height = 375
Left = 4920
TabIndex = 20
Top = 4080
Width = 855
End
Begin VB.CommandButton cmd_add
Caption = "添加"
Enabled = 0 'False
Height = 375
Left = 4080
TabIndex = 19
Top = 4080
Width = 855
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 4920
Width = 3615
_ExtentX = 6376
_ExtentY = 661
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 Frame1
Caption = "員工基本信息"
Height = 1695
Left = 120
TabIndex = 0
Top = 120
Width = 7335
Begin VB.ComboBox Combo3
Height = 300
ItemData = "Frm_yggl.frx":0000
Left = 5040
List = "Frm_yggl.frx":0019
Style = 2 'Dropdown List
TabIndex = 14
Top = 720
Width = 2055
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Frm_yggl.frx":0049
Left = 3240
List = "Frm_yggl.frx":005F
Style = 2 'Dropdown List
TabIndex = 13
Top = 720
Width = 975
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Frm_yggl.frx":008B
Left = 4920
List = "Frm_yggl.frx":0095
Style = 2 'Dropdown List
TabIndex = 12
Top = 240
Width = 735
End
Begin VB.TextBox Text1
Height = 300
Index = 5
Left = 3240
TabIndex = 11
Top = 1200
Width = 3855
End
Begin VB.TextBox Text1
Height = 300
Index = 4
Left = 960
TabIndex = 10
Top = 1200
Width = 1335
End
Begin VB.TextBox Text1
Height = 300
Index = 3
Left = 960
TabIndex = 9
Top = 720
Width = 1335
End
Begin VB.TextBox Text1
Height = 300
Index = 2
Left = 6240
TabIndex = 8
Top = 240
Width = 855
End
Begin VB.TextBox Text1
Height = 300
Index = 1
Left = 3240
TabIndex = 7
Top = 240
Width = 1095
End
Begin VB.TextBox Text1
Height = 300
Index = 0
Left = 960
TabIndex = 6
Top = 240
Width = 1335
End
Begin VB.Label Label1
Caption = "年齡"
Height = 255
Index = 3
Left = 5760
TabIndex = 18
Top = 360
Width = 855
End
Begin VB.Label Label1
Caption = "性別"
Height = 255
Index = 2
Left = 4440
TabIndex = 17
Top = 360
Width = 855
End
Begin VB.Label Label1
Caption = "員工姓名"
Height = 255
Index = 1
Left = 2400
TabIndex = 16
Top = 360
Width = 855
End
Begin VB.Label Label1
Caption = "員工編號"
Height = 255
Index = 0
Left = 120
TabIndex = 15
Top = 360
Width = 855
End
Begin VB.Label Label1
Caption = "現住址"
Height = 255
Index = 8
Left = 2400
TabIndex = 5
Top = 1320
Width = 855
End
Begin VB.Label Label1
Caption = "聯系電話"
Height = 255
Index = 7
Left = 120
TabIndex = 4
Top = 1320
Width = 855
End
Begin VB.Label Label1
Caption = "職稱"
Height = 255
Index = 6
Left = 4440
TabIndex = 3
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "文化程度"
Height = 255
Index = 5
Left = 2400
TabIndex = 2
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "籍貫"
Height = 255
Index = 4
Left = 120
TabIndex = 1
Top = 840
Width = 855
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Frm_yggl.frx":00A1
Height = 2160
Left = 120
TabIndex = 23
Top = 1845
Width = 7320
_ExtentX = 12912
_ExtentY = 3810
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Attribute VB_Name = "Frm_yggl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_add_Click()
Cmd_Add.Enabled = False
cmd_save.Enabled = True
'清空文本框數組中的內容
For i = 0 To 5
Text1(i).Text = ""
Next i
Text1(0).SetFocus
End Sub
Private Sub cmd_del_Click()
c = MsgBox("確認要刪除該信息嗎", 17, "提示信息")
If c = vbOK Then
On Error Resume Next
Set DB_AdoRs = Cnn.Execute("Delete 員工信息 from 員工信息 where 員工編號='" + Text1(0).Text + "'")
'刪除后刷新數據信息
Adodc1.RecordSource = "select * from 員工信息 order by 員工編號"
Adodc1.Refresh
End If
For i = 0 To 5
Text1(i).Text = ""
Next i
End Sub
Private Sub cmd_edit_Click()
c = MsgBox("確認修改信息嗎", 33, "提示信息")
If c = vbOK Then
Set DB_AdoRs = Cnn.Execute("UPDATE 員工信息 SET 員工姓名='" + Text1(1) + "',性別='" + Combo1.Text + "',年齡='" + Text1(2) + "',籍貫='" _
+ Text1(3) + "',文化程度='" + Combo2.Text + "',職稱='" + Combo3.Text + "',聯系電話='" + Text1(4) + "',現住址='" + Text1(5) + "' where 員工編號='" + Text1(0).Text + "'")
MsgBox "數據修改成功", 64, "提示信息"
Adodc1.RecordSource = "select * from 員工信息 order by 員工編號"
Adodc1.Refresh
End If
End Sub
Private Sub cmd_save_Click()
If Text1(1).Text = "" Or Text1(3).Text = "" Then
MsgBox "保存的數據信息不能為空", 48, "提示信息"
Else
DB_AdoRs.Open "select * from 員工信息 where 員工編號='" + Text1(0).Text + "'", Cnn, adOpenKeyset
If DB_AdoRs.RecordCount > 0 Then '判斷要保存的信息是否已經存在
MsgBox "該員工的基本信息已經存在", 48, "提示信息"
DB_AdoRs.Close
Else
DB_AdoRs.Close
c = MsgBox("確認保存信息嗎", 33, "提示信息")
If c = vbOK Then '如果選擇的是“確定”按鈕則保存信息
Set DB_AdoRs = Cnn.Execute("insert into 員工信息 values('" & Text1(0) & "','" & Text1(1) & "','" & Combo1.Text & "','" & Text1(2) & "','" & Text1(3) & "','" _
& Combo2.Text & "','" & Combo3.Text & "','" & Text1(4) & "','" & Text1(5) & "')")
MsgBox "員工信息數據保存成功", 64, "提示信息"
cmd_save.Enabled = False
Cmd_Add.Enabled = True
Else
End If
Adodc1.RecordSource = "select * from 員工信息 order by 員工編號"
Adodc1.Refresh
End If
End If
End Sub
Private Sub DataGrid1_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("員工編號")
Text1(1).Text = Adodc1.Recordset.Fields("員工姓名")
Combo1.Text = Adodc1.Recordset.Fields("性別")
Text1(2).Text = Adodc1.Recordset.Fields("年齡")
Text1(3).Text = Adodc1.Recordset.Fields("籍貫")
Combo2.Text = Adodc1.Recordset.Fields("文化程度")
Combo3.Text = Adodc1.Recordset.Fields("職稱")
Text1(4).Text = Adodc1.Recordset.Fields("聯系電話")
Text1(5).Text = Adodc1.Recordset.Fields("現住址")
End If
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = MyStrs
Adodc1.RecordSource = "select * from 員工信息 order by 員工編號"
Adodc1.Refresh
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -