📄 frmadduser.frm
字号:
VERSION 5.00
Begin VB.Form frmadduser
Caption = "添加用户"
ClientHeight = 5055
ClientLeft = 60
ClientTop = 450
ClientWidth = 5985
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5055
ScaleWidth = 5985
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdcancel
Caption = "取 消"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3480
TabIndex = 7
Top = 4080
Width = 1215
End
Begin VB.CommandButton cmdok
Caption = "确 认"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 6
Top = 4080
Width = 1215
End
Begin VB.TextBox confirmpwd
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
IMEMode = 3 'DISABLE
Left = 3240
MaxLength = 8
PasswordChar = "*"
TabIndex = 2
Top = 3000
Width = 1695
End
Begin VB.TextBox password
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
IMEMode = 3 'DISABLE
Left = 3240
MaxLength = 8
PasswordChar = "*"
TabIndex = 1
Top = 1920
Width = 1695
End
Begin VB.TextBox username
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3240
TabIndex = 0
Top = 840
Width = 1695
End
Begin VB.Label Label3
Caption = "确认密码"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 5
Top = 3000
Width = 1455
End
Begin VB.Label Label2
Caption = "用户密码"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 4
Top = 1920
Width = 1455
End
Begin VB.Label Label1
Caption = "新用户名称"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 3
Top = 840
Width = 1455
End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdcancel_Click()
Unload Me
Exit Sub
End Sub
Private Sub cmdok_Click()
Dim sql As String
Dim rs As ADODB.Recordset
If Trim(username.Text) = "" Then
MsgBox "请输入用户名称", vbOKOnly + vbExclamation, "警告"
Exit Sub
username.SetFocus
Else
sql = "select * from userinfo where userid='" & username & "'"
Set re = getrs(sql, "salary")
If re.EOF = False Then
MsgBox "这个用户已经存在,请重新输入用户名", vbOKOnly + vbExclamation, "警告"
username.SetFocus
username.Text = ""
password.Text = ""
confirmpwd.Text = ""
Exit Sub
Else
If Trim(password.Text) <> Trim(confirmpwd.Text) Then
MsgBox "两次输入密码不一致,请重新输入密码", vbOKOnly + vbExclamation, "警告"
password.Text = ""
confirmpwd.Text = ""
password.SetFocus
Exit Sub
ElseIf Trim(password.Text) = "" Then
MsgBox "密码不能为空", vbOKOnly + vbExclamation, "警告"
password.Text = ""
confirmpwd = ""
password.SetFocus
Else
sql = "insert into userinfo (userid,userpwd) values('" & username
sql = sql & "','" & password & "')"
Call transactsql(sql, "salary")
MsgBox "添加成功", vbOKOnly + vbExclamation, "添加结果"
username.Text = ""
password.Text = ""
confirmpwd.Text = ""
username.SetFocus
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -