?? frmadduser.frm
字號:
VERSION 5.00
Begin VB.Form frmAddUser
Caption = "添加用戶"
ClientHeight = 4320
ClientLeft = 60
ClientTop = 345
ClientWidth = 5970
LinkTopic = "Form1"
ScaleHeight = 4320
ScaleWidth = 5970
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "添加用戶"
Height = 3855
Left = 240
TabIndex = 0
Top = 240
Width = 5535
Begin VB.TextBox Text6
Height = 375
Left = 1200
TabIndex = 14
Top = 2640
Width = 3135
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 1080
TabIndex = 12
Top = 3360
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 3360
TabIndex = 11
Top = 3360
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 1200
TabIndex = 5
Top = 720
Width = 1575
End
Begin VB.TextBox Text4
Height = 375
Left = 1200
TabIndex = 4
Top = 1680
Width = 1575
End
Begin VB.TextBox Text3
Height = 375
Left = 1200
TabIndex = 3
Top = 1200
Width = 1575
End
Begin VB.TextBox Text5
Height = 375
Left = 1200
TabIndex = 2
Top = 2160
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = 1200
TabIndex = 1
Top = 240
Width = 1575
End
Begin VB.Label Label7
Caption = "密碼長度為3~8數字或英文字母"
Height = 255
Left = 2880
TabIndex = 15
Top = 1320
Width = 2535
End
Begin VB.Label Label6
Caption = "聯系地址:"
Height = 255
Left = 360
TabIndex = 13
Top = 2760
Width = 855
End
Begin VB.Label Label1
Caption = "用戶名:"
Height = 255
Left = 360
TabIndex = 10
Top = 360
Width = 735
End
Begin VB.Label Label2
Caption = "用戶編號:"
Height = 255
Left = 360
TabIndex = 9
Top = 840
Width = 855
End
Begin VB.Label Label3
Caption = "密碼:"
Height = 255
Left = 360
TabIndex = 8
Top = 1320
Width = 855
End
Begin VB.Label Label4
Caption = "確認密碼:"
Height = 255
Left = 360
TabIndex = 7
Top = 1800
Width = 855
End
Begin VB.Label Label5
Caption = "聯系電話:"
Height = 255
Left = 360
TabIndex = 6
Top = 2280
Width = 855
End
End
End
Attribute VB_Name = "frmAddUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strempl As String
Dim rs_empl As New ADODB.Recordset
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "請輸入用戶名!", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
Exit Sub
ElseIf Text2.Text = "" Then
MsgBox "請輸入用戶編號!", vbOKOnly + vbInformation, "提示"
Text2.SetFocus
Exit Sub
ElseIf Text3.Text = "" Then
MsgBox "請輸入密碼!", vbOKOnly + vbInformation, "提示"
Text3.SetFocus
Exit Sub
ElseIf Text4.Text = "" Then
MsgBox "請輸入確認密碼!", vbOKOnly + vbInformation, "提示"
Text4.SetFocus
Exit Sub
ElseIf Text5.Text = "" Then
MsgBox "請輸入聯系電話!", vbOKOnly + vbInformation, "提示"
Text5.SetFocus
Exit Sub
ElseIf Text6.Text = "" Then
MsgBox "請輸入聯系地址!", vbOKOnly + vbInformation, "提示"
Text6.SetFocus
Exit Sub
End If
If Len(Text3.Text) < 3 Or Len(Text3.Text) > 8 Then
MsgBox "密碼長度不符合要求!", vbOKOnly + vbInformation, "提示"
Text3.Text = ""
Text3.SetFocus
Exit Sub
End If
If Text3.Text <> Text4.Text Then
MsgBox "兩次輸入的密碼不一致!", vbOKOnly + vbInformation, "注意"
Text3.Text = ""
Text4.Text = ""
Text3.SetFocus
Exit Sub
End If
strempl = "select * from employee where 員工編號='" & Text2.Text & "'"
rs_empl.Open strempl, cnn, adOpenKeyset, adLockOptimistic
If rs_empl.EOF = True Then
rs_empl.AddNew
rs_empl.Fields("員工編號") = Text2.Text
rs_empl.Fields("員工密碼") = Text3.Text
rs_empl.Fields("員工姓名") = Text1.Text
rs_empl.Fields("員工電話") = Text5.Text
rs_empl.Fields("員工地址") = Text6.Text
rs_empl.Update
rs_empl.Close
Else
MsgBox "該用戶名已存在,請重新輸入!", vbOKOnly + vbInformation, "注意"
rs_empl.Close
Exit Sub
End If
MsgBox "添加用戶成功!", vbOKOnly + vbInformation, ""
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -