?? frm_adduser.frm
字號:
VERSION 5.00
Begin VB.Form frm_adduser
Caption = "添加用戶"
ClientHeight = 2550
ClientLeft = 60
ClientTop = 450
ClientWidth = 4155
LinkTopic = "Form1"
ScaleHeight = 2550
ScaleWidth = 4155
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Fault
Caption = "取消"
Height = 375
Left = 2400
TabIndex = 8
Top = 2040
Width = 1095
End
Begin VB.CommandButton cmd_add
Caption = "添加"
Height = 375
Left = 840
TabIndex = 7
Top = 2040
Width = 1095
End
Begin VB.Frame Frame1
Height = 1575
Left = 360
TabIndex = 0
Top = 240
Width = 3615
Begin VB.TextBox checkpassword
Height = 285
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 6
Top = 1080
Width = 1695
End
Begin VB.TextBox password
Height = 285
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 4
Top = 720
Width = 1695
End
Begin VB.TextBox username
Height = 285
Left = 1560
TabIndex = 2
Top = 360
Width = 1695
End
Begin VB.Label Label3
Caption = "重復密碼"
Height = 255
Left = 120
TabIndex = 5
Top = 1080
Width = 1215
End
Begin VB.Label Label2
Caption = "密碼"
Height = 255
Left = 120
TabIndex = 3
Top = 720
Width = 1215
End
Begin VB.Label Label1
Caption = "用戶名"
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 1215
End
End
End
Attribute VB_Name = "frm_adduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmd_add_Click()
Dim strSQL As String
If Username.Text = "" Then
MsgBox "用戶名不能為空", vbOKOnly
Exit Sub
End If
If Password.Text <> checkpassword.Text Then
MsgBox "兩次輸入密碼不同", vbOKOnly
Password.SetFocus
Exit Sub
Else
OpenDB
strSQL = "Select * from Users where username ='" + Trim(Username.Text) + "'"
objRS.Open strSQL, objConn, adOpenDynamic, adLockOptimistic
If objRS.EOF Then
objRS.AddNew
objRS.Fields(0).Value = Trim(Username.Text)
objRS.Fields(1).Value = Trim(Password.Text)
objRS.Update
objRS.Close
CloseDB
MsgBox "用戶已添加", vbOKOnly
Unload Me
Exit Sub
Else
objRS.Close
CloseDB
MsgBox "用戶名已存在", vbOKOnly
Exit Sub
End If
End If
End Sub
Private Sub fault_Click()
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -