📄 form4.frm
字号:
Top = 1800
Width = 855
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "Label1"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 1200
TabIndex = 4
Top = 900
Width = 1695
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "Label1"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 1200
TabIndex = 3
Top = 420
Width = 1695
End
End
Attribute VB_Name = "form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo4_Change()
If KeyAscii = 13 Then
If combo4.Text = "否" Then
combo4.Text = "是"
Exit Sub
Else
combo4.Text = "否"
End If
Else
Exit Sub
End If
End Sub
Private Sub Command1_Click()
Call xpbutton1_Click
End Sub
Private Sub Form_Load()
Combo1.AddItem "学生"
Combo1.AddItem "教师"
Combo1.AddItem "工人"
Combo2.AddItem "男"
Combo2.AddItem "女"
Combo3.AddItem "是"
Combo3.AddItem "否"
combo4.AddItem "是"
combo4.AddItem "否"
Me.BackColor = RGB(121, 153, 207)
Dim data1 As String
DTPicker2.Value = Date + 1460
utid2
End Sub
Private Sub Image1_Click()
Unload Me
End Sub
Private Sub xpbutton1_Click()
If ifuser = "4" Then
MsgBox "当前为查询状态,请转到管理员操作界面进行此操作", vbInformation, "错误"
Exit Sub
End If
If admin = False Then '检测是否具有管理员权限
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If Text1.Visible = False Then
Exit Sub
End If
If sts1.State = adStateOpen Then '检测数据库是否打开状态
sts1.Close
End If
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "编号和姓名不可为空,请检查看输入", vbInformation, "输入错误"
Exit Sub
End If
sts1.Open "select * from 个人信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While sts1.EOF = False
If sts1.Fields(0) = Text1.Text Then
MsgBox "您输入的编号己存在!", vbInformation, "编号重复"
Text1.Text = ""
Exit Sub
Else
sts1.MoveNext
End If
Loop
sts1.AddNew
sts1.Fields(0) = Text1.Text + t '学号
sts1.Fields(1) = Text2.Text '姓名
sts1.Fields(2) = Text4.Text '密码
sts1.Fields(3) = Combo2.Text '性别
sts1.Fields(4) = DTPicker1.Value '出生日期
sts1.Fields(5) = Combo1.Text '职业
sts1.Fields(6) = Text3.Text '单位
sts1.Fields(7) = DTPicker2.Value '借书证到期时间
sts1.Fields(8) = Combo3.Text '是否特殊用户
sts1.Fields(9) = "0" '己借书本数
sts1.Fields(10) = combo4.Text '是否为管理员
sts1.Update
MsgBox "数据己添加成功", vbInformation, "添加成功"
End Sub
Private Sub xpbutton2_Click()
If ifuser = "4" Then
MsgBox "不可删除本人资料!", vbInformation, "错误"
Exit Sub
End If
If admin = False Then
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If Text1.Visible = False Then
Exit Sub
End If
If sts1.State = adStateOpen Then
sts1.Close
End If
sts1.Open "select * from 个人信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While sts1.EOF = False
If sts1.Fields(0) = Text1.Text Then
sts1.Delete
sts1.Update
MsgBox "数据己删除", vbInformation, "删除用户"
Unload Me
Else
sts1.MoveNext
End If
Loop
End Sub
Private Sub xpbutton3_Click()
If ifuser = "4" Then
MsgBox "查询不可在此时进行,当数据显示为文本框可输!", vbInformation, "错误"
Exit Sub
End If
If admin = False Then
MsgBox "非管理员不可使用"
Exit Sub
End If
If Text1.Visible = False Then
Exit Sub
End If
If sts1.State = adStateOpen Then
sts1.Close
End If
sts1.Open "select * from 个人信息 where 学号='" & Text1.Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Text1.Text = sts1.Fields(0)
Text2.Text = sts1.Fields(1)
Combo2.Text = sts1.Fields(3)
DTPicker1.Value = sts1.Fields(4)
Combo1.Text = sts1.Fields(5)
Text3.Text = sts1.Fields(6)
DTPicker2.Value = sts1.Fields(7)
Combo3.Text = sts1.Fields(8)
Label9.Visible = True
Label9.Caption = sts1.Fields(9)
combo4.Text = sts1.Fields(10)
End Sub
Private Sub xpbutton4_Click()
If ifuser = "4" Then
MsgBox "当前为查询状态,请转到管理员操作界面中编辑状态进行此操作", vbInformation, "错误"
Exit Sub
End If
If admin = False Then
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If Text1.Visible = False Then
Exit Sub
End If
If sts1.State = adStateOpen Then
sts1.Close
End If
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "编号和姓名不可为空,请检查看输入", vbInformation, "输入错误"
Exit Sub
End If
sts1.Open "select * from 个人信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While sts1.EOF = False
If sts1.Fields(0) = Text1.Text Then
sts1.Fields(1) = Text2.Text '姓名
sts1.Fields(2) = Text4.Text '密码
sts1.Fields(3) = Combo2.Text '性别
sts1.Fields(4) = DTPicker1.Value '出生日期
sts1.Fields(5) = Combo1.Text '职业
sts1.Fields(6) = Text3.Text '单位
sts1.Fields(7) = DTPicker2.Value '借书证到期时间
sts1.Fields(8) = Combo3.Text '是否特殊用户
sts1.Fields(10) = combo4.Text '是否为管理员
sts1.Update
MsgBox "数据己修改成功", vbInformation, "修改成功"
Exit Sub
Else
sts1.MoveNext
End If
Loop
End Sub
Private Sub vt1() '设定添加系统所有控件隐藏
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Combo1.Visible = False
Combo2.Visible = False
Combo3.Visible = False
combo4.Visible = False
DTPicker1.Visible = False
DTPicker2.Visible = False
End Sub
Private Sub vt3() '设定添加系统所有控件显示
Text1.Visible = True
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Combo1.Visible = True
Combo2.Visible = True
Combo3.Visible = True
combo4.Visible = True
DTPicker1.Visible = True
DTPicker2.Visible = True
End Sub
Private Sub vt2() '设定显示个人信息所有控件隐藏
Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Label7.Visible = False
Label8.Visible = False
Label10.Visible = False
End Sub
Private Sub vt4() '设定显示个人信息所有控件显示
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
Label7.Visible = True
Label8.Visible = True
Label10.Visible = True
End Sub
Private Sub Timer2_Timer()
If ifuser = "4" Then
vt1
If sts1.State = adStateOpen Then
sts1.Close
End If
sts1.Open "select * from 个人信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While sts1.EOF = False
If sts1.Fields(0) = id Then '去除密码项,增加保密
Label1.Caption = sts1.Fields(0)
Label2.Caption = sts1.Fields(1)
Label3.Caption = sts1.Fields(3)
Label4.Caption = Str(sts1.Fields(4))
Label5.Caption = sts1.Fields(5)
Label6.Caption = sts1.Fields(6)
Label7.Caption = Str(sts1.Fields(7))
Label8.Caption = sts1.Fields(8)
Label9.Caption = sts1.Fields(9)
Label10.Caption = sts1.Fields(10)
vt4
Exit Sub
Else
sts1.MoveNext
End If
Loop
Exit Sub
End If
If ifuser = "6" Then
vt2
vt3
Exit Sub
End If
Timer2.Interval = 0
End Sub
Private Sub utid2()
If ifuser = "5" Then
If sts1.State = adStateOpen Then
sts1.Close
End If
sts1.Open "select * from 个人信息 where 学号='" & tkUserID & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Text1.Text = sts1.Fields(0)
Text2.Text = sts1.Fields(1)
Combo2.Text = sts1.Fields(3)
DTPicker1.Value = sts1.Fields(4)
Combo1.Text = sts1.Fields(5)
Text3.Text = sts1.Fields(6)
DTPicker2.Value = sts1.Fields(7)
Combo3.Text = sts1.Fields(8)
Label9.Visible = True
Label9.Caption = sts1.Fields(9)
combo4.Text = sts1.Fields(10)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -