📄 setadmin.frm
字号:
VERSION 5.00
Begin VB.Form setadmin
BorderStyle = 1 'Fixed Single
Caption = "管理员设置"
ClientHeight = 5940
ClientLeft = 4185
ClientTop = 2775
ClientWidth = 7950
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 5940
ScaleWidth = 7950
Begin VB.Frame Frame4
Caption = "用户删除"
Height = 975
Left = 120
TabIndex = 24
Top = 4560
Width = 7575
Begin VB.CommandButton Command5
Caption = "删除(&D)"
Height = 375
Left = 5520
TabIndex = 27
Top = 360
Width = 1695
End
Begin VB.TextBox Text8
BackColor = &H00C0FFFF&
Height = 375
Left = 1320
TabIndex = 26
Top = 360
Width = 2295
End
Begin VB.Label Label8
Caption = "用户名称:"
Height = 255
Left = 360
TabIndex = 25
Top = 480
Width = 975
End
End
Begin VB.Frame Frame3
Caption = "用户修改"
Height = 4335
Left = 4080
TabIndex = 13
Top = 120
Width = 3615
Begin VB.CommandButton Command4
Caption = "取消(&X)"
Height = 375
Left = 2040
TabIndex = 23
Top = 3720
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "修改(&E)"
Height = 375
Left = 360
TabIndex = 22
Top = 3720
Width = 1215
End
Begin VB.TextBox Text7
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 21
Top = 2160
Width = 1935
End
Begin VB.TextBox Text6
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 19
Top = 1560
Width = 1935
End
Begin VB.TextBox Text5
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 17
Top = 960
Width = 1935
End
Begin VB.TextBox Text4
Height = 375
Left = 1320
TabIndex = 15
Top = 360
Width = 1935
End
Begin VB.Label Label7
Caption = "密码确认:"
Height = 375
Left = 360
TabIndex = 20
Top = 2280
Width = 975
End
Begin VB.Label Label6
Caption = "密码修改:"
Height = 255
Left = 360
TabIndex = 18
Top = 1680
Width = 975
End
Begin VB.Label Label5
Caption = "登陆密码:"
Height = 375
Left = 360
TabIndex = 16
Top = 1080
Width = 975
End
Begin VB.Label Label4
Caption = "登陆名称:"
Height = 375
Left = 360
TabIndex = 14
Top = 480
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "新用户添加"
Height = 4335
Left = 120
TabIndex = 0
Top = 120
Width = 3735
Begin VB.CommandButton Command2
Caption = "取消(&C)"
Height = 375
Left = 2280
TabIndex = 12
Top = 3720
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加(&A)"
Height = 375
Left = 120
TabIndex = 11
Top = 3720
Width = 1215
End
Begin VB.Frame Frame2
Caption = "操作权限"
Height = 1455
Left = 120
TabIndex = 7
Top = 2040
Width = 3495
Begin VB.OptionButton Option3
Caption = "图书管理员"
Height = 375
Left = 2040
TabIndex = 10
Top = 840
Width = 1335
End
Begin VB.OptionButton Option2
Caption = "数据库维护员"
Height = 375
Left = 240
TabIndex = 9
Top = 840
Width = 1455
End
Begin VB.OptionButton Option1
Caption = "超级管理员"
Height = 375
Left = 240
TabIndex = 8
Top = 240
Width = 1335
End
End
Begin VB.TextBox Text3
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 6
Top = 1560
Width = 1935
End
Begin VB.TextBox Text2
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 4
Top = 960
Width = 1935
End
Begin VB.TextBox Text1
BackColor = &H00C0FFFF&
Height = 375
Left = 1320
TabIndex = 2
Top = 360
Width = 1935
End
Begin VB.Label Label3
Caption = "密码确认:"
Height = 375
Left = 360
TabIndex = 5
Top = 1680
Width = 975
End
Begin VB.Label Label2
Caption = "密 码:"
Height = 375
Left = 360
TabIndex = 3
Top = 1080
Width = 975
End
Begin VB.Label Label1
Caption = "登陆名称:"
Height = 255
Left = 360
TabIndex = 1
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "setadmin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "登陆名称不能为空!", vbInformation + vbOKOnly, "警告"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "登陆密码不能为空!", vbInformation + vbOKOnly, "警告"
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "密码确认不能为空!", vbInformation + vbOKOnly, "警告"
Text3.SetFocus
Exit Sub
End If
If Text2.Text <> Text3.Text Then
MsgBox "两次密码不一样,请重新输入!", vbInformation + vbOKOnly, "提示"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Exit Sub
End If
If Option1.Value = False And Option2.Value = False And Option3.Value = False Then
MsgBox "请选择操作权限!", vbInformation + vbOKOnly, "警告"
Exit Sub
End If
Set g_rs = g_db.OpenRecordset("select * from systeminfo where 名称='" & Text1.Text & "'")
If g_rs.EOF = False Then
MsgBox "对不起,你所选择的用户名已经存在,请换一个登陆名!", vbInformation + vbOKOnly, "信息"
Text1.Text = ""
Text1.SetFocus
Set g_rs = Nothing
Exit Sub
Else
Set g_rs = Nothing
Set g_rs = g_db.OpenRecordset("select * from systeminfo ")
g_rs.AddNew
g_rs!名称 = Text1.Text
g_rs!密码 = Text2.Text
If Option1.Value = True Then
g_rs!超级管理员 = True
End If
If Option2.Value = True Then
g_rs!数据库维护员 = True
End If
If Option3.Value = True Then
g_rs!图书管理员 = True
End If
g_rs.Update
Set g_rs = Nothing
MsgBox "用户添加成功,请返回!", vbInformation + vbOKOnly, "提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Option1.Value = False
Option2.Value = False
Option3.Value = False
End Sub
Private Sub Command3_Click()
If Text4.Text = "" Then
MsgBox "登陆名称不能为空!", vbInformation + vbOKOnly, "警告"
Text4.SetFocus
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "登陆密码不能为空!", vbInformation + vbOKOnly, "警告"
Text5.SetFocus
Exit Sub
End If
If Text6.Text <> Text7.Text Then
MsgBox "两次密码不一样,请重新输入!", vbInformation + vbOKOnly, "提示"
Text6.Text = ""
Text7.Text = ""
Text6.SetFocus
Exit Sub
End If
g_strsql = "select * from systeminfo where 名称='" & Text4.Text & "' and 密码='" & Text5.Text & "'"
Set g_rs = g_db.OpenRecordset(g_strsql)
If Not g_rs.EOF Then
g_rs.Edit
g_rs!密码 = Text6.Text
g_rs.Update
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Set g_rs = Nothing
MsgBox "用户" + Text4.Text + "的密码修改成功!", vbInformation + vbOKOnly, "信息"
Else
MsgBox "对不起,请核对你输入的用户和密码是否正确!", vbInformation + vbOKOnly, "信息"
Set g_rs = Nothing
Exit Sub
End If
End Sub
Private Sub Command4_Click()
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text4.SetFocus
End Sub
Private Sub Command5_Click()
If Text8.Text = "" Then
MsgBox "登陆名称不能为空!", vbInformation + vbOKOnly, "警告"
Text1.SetFocus
Exit Sub
End If
Set g_rs = g_db.OpenRecordset("select * from systeminfo where 名称='" & Text8.Text & "'")
If g_rs.RecordCount > 0 Then
If MsgBox("你是否确定删除登陆名为:" + Text8.Text + "的用户?", vbInformation + vbOKCancel, "删除") = vbOK Then
g_rs.Delete
MsgBox "删除成功,请返回!"
Text8.Text = ""
Set g_rs = Nothing
Else
Text8.Text = ""
Set g_rs = Nothing
End If
Else
MsgBox "对不起,没有该用户信息!", vbInformation + vbOKOnly, "信息"
End If
End Sub
Private Sub Form_Load()
dbl
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -