📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form Form3
BorderStyle = 1 'Fixed Single
Caption = "管理员注册"
ClientHeight = 4605
ClientLeft = 45
ClientTop = 435
ClientWidth = 5115
LinkTopic = "Form3"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4605
ScaleWidth = 5115
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 2640
TabIndex = 7
Top = 2880
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 600
TabIndex = 6
Top = 2880
Width = 1575
End
Begin VB.TextBox Text3
Height = 495
Left = 1920
TabIndex = 5
Top = 2040
Width = 2295
End
Begin VB.TextBox Text2
Height = 495
Left = 1920
TabIndex = 4
Top = 1200
Width = 2295
End
Begin VB.TextBox Text1
Height = 495
Left = 1920
TabIndex = 2
Top = 360
Width = 2295
End
Begin VB.Label Label3
Caption = "确认密码:"
Height = 375
Left = 600
TabIndex = 3
Top = 2160
Width = 975
End
Begin VB.Label Label2
Caption = "请输入密码:"
Height = 375
Left = 600
TabIndex = 1
Top = 1320
Width = 1095
End
Begin VB.Label Label1
Caption = "管理员名:"
Height = 375
Left = 600
TabIndex = 0
Top = 480
Width = 975
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sql As String
Dim rs As New ADODB.Recordset
Dim cnn As ADODB.Connection
Private Sub Command1_Click()
Dim sql As String
Dim rs As New ADODB.Recordset
If Trim(Text1.Text) = "" Then
MsgBox "管理名不能为空", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Exit Sub
Else
sql = "select * from 管理员表"
rs.Open sql, cnn, adOpenKeyset, adLockPessimistic
While (rs.EOF = False)
If Trim(rs.Fields(0)) = Trim(Text1.Text) Then
MsgBox "已有这个用户", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Exit Sub
Else
rs.MoveNext
End If
Wend
If Trim(Text2.Text) = "" Then
MsgBox "密码不能为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text2.Text = ""
Text2.SetFocus
Exit Sub
End If
If Trim(Text2.Text) <> Trim(Text3.Text) Then
MsgBox "两次密码不一致", vbOKOnly + vbExclamation, ""
Text2.SetFocus
Text2.Text = ""
Text3.Text = ""
Exit Sub
Else
rs.AddNew
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text2.Text
rs.Update
rs.Close
MsgBox "管理员添加成功", vbOKOnly + vbExclamation, ""
Unload Me
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text2.PasswordChar = "*"
Text3.PasswordChar = "*"
Set cnn = New ADODB.Connection
cnn.Open "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\信息表.mdb;Persist Security Info=False"
Set rs = New ADODB.Recordset
rs.Open "select * from 管理员表", cnn, adOpenDynamic, adLockOptimistic
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -