【VB开源代码栏目提醒】:网学会员VB开源代码为您提供user_insert.frm参考,解决您在user_insert.frm学习中工作中的难题,参考学习。
VERSION 5.00
Begin VB.Form Form8
Caption = "管理员添加"
ClientHeight = 4575
ClientLeft = 60
ClientTop = 345
ClientWidth = 5370
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form8"
ScaleHeight = 4575
ScaleWidth = 5370
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Height = 375
Left = 2520
TabIndex = 0
Top = 480
Width = 1815
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 1
Top = 1200
Width = 1815
End
Begin VB.TextBox Text3
Height = 375
IMEMode = 3 'DISABLE
Left = 2520
Pass
wordChar = "*"
TabIndex = 2
Top = 2040
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 1200
TabIndex = 3
Top = 3120
Width = 975
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3240
TabIndex = 4
Top = 3120
Width = 975
End
Begin
VB.Label Label1
Caption = "用 户 名:"
Height = 375
Index = 0
Left = 600
TabIndex = 7
Top = 480
Width = 1815
End
Begin VB.Label Label1
Caption = "密 码:"
Height = 375
Index = 1
Left = 600
TabIndex = 6
Top = 1200
Width = 1815
End
Begin VB.Label Label1
Caption = "密码确认:"
Height = 375
Index = 2
Left = 600
TabIndex = 5
Top = 2040
Width = 1815
End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\file.mdb;Persist Security Info=False"
If Trim(Text1.Text) = "" Then
MsgBox "用户名不能为空"
Else
sql = "select * from adminfo where aname='" & Text1.Text & "'"
rs.Open
sql, cn, 3, 2
If rs.EOF = False Then
MsgBox "用户名已存在,请重新输入"
Me.Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
Else
If Text2.Text <> Text3.Text Then
MsgBox "两次密码输入不一致,请确认"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Else
rs.AddNew
rs("aname") = Text1.Text
rs("apass") = Text2.Text
rs.Update
MsgBox "添加成功"
Me.Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub