?? frm_adduser.frm
字號(hào):
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_addUser
Caption = "添加用戶"
ClientHeight = 3420
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3420
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 600
Top = 2280
Visible = 0 'False
Width = 2415
_ExtentX = 4260
_ExtentY = 582
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= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=CarSaleSys"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "CarSaleSys"
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 8
Top = 2880
Width = 855
End
Begin VB.CommandButton Cmd_OK
Caption = "確定"
Height = 375
Left = 960
TabIndex = 7
Top = 2880
Width = 855
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 2535
Left = 240
TabIndex = 0
Top = 120
Width = 4095
Begin VB.OptionButton Option2
Caption = "Option2"
Height = 200
Left = 2600
TabIndex = 12
Top = 1800
Width = 255
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 200
Left = 1560
TabIndex = 10
Top = 1800
Width = 255
End
Begin VB.TextBox txtSurePwd
Appearance = 0 'Flat
Height = 300
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 6
Top = 1200
Width = 1500
End
Begin VB.TextBox txtPwd
Appearance = 0 'Flat
Height = 300
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 4
Width = 1500
End
Begin VB.TextBox txtUser
Appearance = 0 'Flat
Height = 300
Left = 1800
TabIndex = 2
Top = 240
Width = 1500
End
Begin VB.Label Label6
Caption = "普通用戶"
Height = 255
Left = 2880
TabIndex = 13
Top = 1800
Width = 855
End
Begin VB.Label Label5
Caption = "管理員"
Height = 375
Left = 1920
TabIndex = 11
Top = 1800
Width = 615
End
Begin VB.Label Label4
Caption = "用戶類型"
Height = 255
Left = 480
TabIndex = 9
Top = 1800
Width = 855
End
Begin VB.Label Label3
Caption = "確認(rèn)密碼"
Height = 255
Left = 480
TabIndex = 5
Top = 1320
Width = 975
End
Begin VB.Label Label2
Caption = "輸入密碼"
Height = 255
Left = 480
TabIndex = 3
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "輸入用戶名"
Height = 375
Left = 480
TabIndex = 1
Top = 360
Width = 1095
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_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
Dim usertype As Integer
'數(shù)據(jù)有效性檢查
If txtUser = "" Then
MsgBox "請(qǐng)輸入用戶名"
txtUser.SetFocus
Exit Sub
End If
Adodc1.RecordSource = "SELECT * FROM Users WHERE User_name = '" + Trim(txtUser.Text) + "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Then
MsgBox "已經(jīng)有此用戶,請(qǐng)重新輸入"
txtUser.SetFocus
Exit Sub
Else
If txtPwd = "" Then
MsgBox "請(qǐng)輸入密碼"
txtPwd.SetFocus
Exit Sub
End If
If txtSurePwd = "" Then
MsgBox "請(qǐng)確認(rèn)密碼"
txtSurePwd.SetFocus
Exit Sub
End If
If Option1 = True Then
usertype = 0
ElseIf Option2 = True Then
usertype = 1
Else
MsgBox "請(qǐng)選擇用戶類型"
Exit Sub
End If
If Len(txtPwd) < 6 Then
MsgBox "密碼長(zhǎng)度不能小于6"
txtPwd.SetFocus
txtPwd.SelStart = 0
txtPwd.SelLength = Len(txtPwd)
Exit Sub
End If
If txtPwd <> txtSurePwd Then
MsgBox "密碼和確認(rèn)密碼不相同,請(qǐng)重新確認(rèn)"
txtSurePwd.SetFocus
txtSurePwd.SelStart = 0
txtSurePwd.SelLength = Len(txtSurePwd)
Exit Sub
End If
'增加新用戶
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0).Value = Trim(txtUser.Text)
Adodc1.Recordset.Fields(1).Value = Trim(txtPwd.Text)
Adodc1.Recordset.Fields(2).Value = usertype
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox "用戶增加完成"
Unload Me
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -