📄 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.CommandButton Command6
Caption = "关 闭"
Height = 375
Left = 3240
TabIndex = 22
Top = 5400
Width = 1695
End
Begin VB.Frame Frame4
Caption = "用户删除"
Height = 975
Left = 120
TabIndex = 18
Top = 4200
Width = 7575
Begin VB.CommandButton Command5
Caption = "删除(&D)"
Height = 375
Left = 5520
TabIndex = 21
Top = 360
Width = 1695
End
Begin VB.TextBox Text8
BackColor = &H00C0FFFF&
Height = 375
Left = 1320
TabIndex = 20
Top = 360
Width = 2295
End
Begin VB.Label Label8
Caption = "用户名称:"
Height = 255
Left = 360
TabIndex = 19
Top = 480
Width = 975
End
End
Begin VB.Frame Frame3
Caption = "用户修改"
Height = 3975
Left = 4080
TabIndex = 8
Top = 120
Width = 3615
Begin VB.CommandButton Command3
Caption = "修改(&E)"
Height = 375
Left = 2040
TabIndex = 17
Top = 3360
Width = 1215
End
Begin VB.TextBox Text7
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 16
Top = 2520
Width = 1935
End
Begin VB.TextBox Text6
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 14
Top = 1800
Width = 1935
End
Begin VB.TextBox Text5
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 12
Top = 1080
Width = 1935
End
Begin VB.TextBox Text4
Height = 375
Left = 1320
TabIndex = 10
Top = 360
Width = 1935
End
Begin VB.Label Label7
Caption = "密码确认:"
Height = 375
Left = 360
TabIndex = 15
Top = 2640
Width = 975
End
Begin VB.Label Label6
Caption = "密码修改:"
Height = 255
Left = 360
TabIndex = 13
Top = 1920
Width = 975
End
Begin VB.Label Label5
Caption = "登陆密码:"
Height = 375
Left = 360
TabIndex = 11
Top = 1200
Width = 975
End
Begin VB.Label Label4
Caption = "登陆名称:"
Height = 375
Left = 360
TabIndex = 9
Top = 480
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "新用户添加"
Height = 3975
Left = 120
TabIndex = 0
Top = 120
Width = 3735
Begin VB.CommandButton Command1
Caption = "添加(&A)"
Height = 375
Left = 2040
TabIndex = 7
Top = 3360
Width = 1215
End
Begin VB.TextBox Text3
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 6
Top = 2520
Width = 1935
End
Begin VB.TextBox Text2
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 4
Top = 1440
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 = 240
TabIndex = 5
Top = 2520
Width = 975
End
Begin VB.Label Label2
Caption = "密 码:"
Height = 375
Left = 240
TabIndex = 3
Top = 1560
Width = 975
End
Begin VB.Label Label1
Caption = "登陆名称:"
Height = 255
Left = 240
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
Private Sub Command1_Click()
Dim InsertStr As String '定义变量接受用户添加信息的值
'向读者基本信息表添加文本框中输入的信息
InsertStr = "INSERT INTO readerInfo VALUES('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "')"
On Error GoTo errhander '添加程序错误时执行errhander
'输入信息正确时执行
Mycon.BeginTrans
Mycon.Execute (InsertStr)
Mycon.CommitTrans
MsgBox "添加成功" '添加成功时给出提示
'添加成功后将文本框内容清空
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
'Exit Sub '强制退出
errhander:
MsgBox "添加失败" '错误时给出提示
Mycon.RollbackTrans
End Sub
Private Sub Command3_Click()
'用记录集对象打开读者基本信息表
myrs.Open "读者基本信息表", Mycon, adOpenKeyset, adLockBatchOptimistic, adCmdTable
rennewbook.Show 1 '显示窗体,进行修改
End Sub
Private Sub Command5_Click()
Dim Str As String, Name As String
'将输入框中的内容赋给变量
Name = InputBox("请输入用户名称(可以进行模糊删除)", 提示, "")
'Str = "DELETE 读者基本信息表 FROM 选课信息表 INNER JOIN 学生基本信息表 on 学生基本信息表.stuID=选课信息表.stuID where 学生基本信息表.name like'" & Trim(Name) & "%'"
Str = "DELETE readerInfo FROM 管理员信息表 where readerInfo.name like'" & Trim(Name) & "%'"
Mycon.BeginTrans '开始事务
Mycon.Execute (Str) '执行
'消息框提示赋给变量
a = MsgBox("删除读者生基本信息表中的记录将会删除相关的其它表的信息,真的要删除吗?", vbOKCancel + vbExclamation, "提示")
If a = vbOK Then '判断消息框的按钮是否为真
Mycon.CommitTrans '错误陷阱
MsgBox "指定用户名称的相关信息已经从数据库中删除", vbInformation, "注意"
Else
Mycon.RollbackTrans '回滚事务
MsgBox "撤消删除", vbInformation, "提示"
End If
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -