📄 useredit.frm
字号:
Begin VB.CheckBox Check1
Caption = "文化课成绩管理"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 3
Left = 360
TabIndex = 7
Top = 1200
Width = 2055
End
Begin VB.CheckBox Check1
Caption = "学生名册管理"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 2
Left = 360
TabIndex = 6
Top = 720
Width = 2055
End
Begin VB.CheckBox Check1
Caption = "班级管理"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 1
Left = 360
TabIndex = 5
Top = 240
Width = 2055
End
End
Begin MSComctlLib.ImageList ImageList1
Left = 9600
Top = 3120
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "useredit.frx":030A
Key = ""
EndProperty
EndProperty
End
Begin VB.PictureBox Picture1
BackColor = &H00FFE09E&
Height = 5655
Left = 0
Picture = "useredit.frx":0626
ScaleHeight = 5595
ScaleWidth = 2235
TabIndex = 0
TabStop = 0 'False
Top = 0
Width = 2295
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "系统安全管理"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Index = 1
Left = 165
TabIndex = 1
Top = 1005
Width = 2535
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "系统安全管理"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Index = 0
Left = 130
TabIndex = 2
Top = 970
Width = 2655
End
Begin VB.Image Image1
Height = 720
Left = 240
Picture = "useredit.frx":3A68A
Stretch = -1 'True
Top = 120
Width = 720
End
Begin VB.Shape Shape1
BorderColor = &H000000FF&
BorderWidth = 2
Height = 15
Left = 120
Top = 1440
Width = 1575
End
Begin VB.Shape Shape2
BorderColor = &H0000FF00&
BorderWidth = 2
Height = 15
Left = 120
Top = 1485
Width = 1455
End
End
Begin MSComctlLib.ListView ListView1
Height = 5655
Left = 2280
TabIndex = 3
Top = 0
Width = 2655
_ExtentX = 4683
_ExtentY = 9975
View = 3
Arrange = 1
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
AllowReorder = -1 'True
GridLines = -1 'True
_Version = 393217
Icons = "ImageList1"
SmallIcons = "ImageList1"
ColHdrIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483634
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 1
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "用户名称"
Object.Width = 2540
EndProperty
End
End
Attribute VB_Name = "useredit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public cc As New ADODB.Connection
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
a = Right(ListView1.SelectedItem.Key, Len(ListView1.SelectedItem.Key) - 1)
If a <> 1 Then
If Check1(11) = 1 Then
If MsgBox("使普通用户拥有系统安全管理功能是十分危险的" & Chr(13) & Chr(10) & "您是否确定使此普通用户拥有此功能?", vbYesNo, "警告") <> vbYes Then
Check1(11).Value = 0
End If
End If
Else
If Check1(11) = 0 Then
MsgBox "root用户必须拥有系统安全管理功能", vbOKOnly Or vbInformation, "提示"
Check1(11) = 1
End If
End If
Dim temp As New ADODB.Recordset
temp.Open "select * from [user] where [ID]=" & a, cc, 3, 2
If temp.RecordCount = 0 Then
Exit Sub
End If
For i = 1 To 14
temp.Fields(2 + i) = Check1(i)
Next
temp.Update
temp.Close
MsgBox "修改已经完成", vbOKOnly Or vbInformation, "提示"
End Sub
Private Sub Command3_Click()
Dim temp As New useredit_addu
temp.Show 1
If temp.yesno = False Then
Exit Sub
End If
cc.Execute "insert into [user]([uname],[pas])values('" & temp.nn & "','" & temp.pp & "')"
Dim kk As New ADODB.Recordset
kk.Open "select * from [user]", cc, 3, 2
kk.MoveLast
ListView1.ListItems.Add , "S" & kk.Fields(0), kk.Fields(1), 1, 1
End Sub
Private Sub Command4_Click()
If ListView1.SelectedItem.Key = "S1" Then
MsgBox "[root]用户不能删除", vbOKOnly Or vbInformation, "提示"
Exit Sub
End If
If MsgBox("您是否确定删除[" & ListView1.SelectedItem.Text & "]吗?", vbYesNo Or vbQuestion, "提示") = vbYes Then
cc.Execute "Delete from [user] where [ID]=" & Right(ListView1.SelectedItem.Key, Len(ListView1.SelectedItem.Key) - 1)
ListView1.ListItems.Remove ListView1.SelectedItem.Index
End If
End Sub
Private Sub Command5_Click()
Dim ff As New useredit_edp1
Dim ff2 As New useredit_edp2
If ListView1.SelectedItem.Key = "S1" Then
ff.Show 1
If ff.yesno = False Then Exit Sub
pp = ff.nn
Else
ff2.Show 1
If ff2.yesno = False Then Exit Sub
pp = ff2.nn
End If
cc.Execute "update [user] set [pas]='" & pp & "' where [ID]=" & Right(ListView1.SelectedItem.Key, Len(ListView1.SelectedItem.Key) - 1)
MsgBox "修改成功", vbOKOnly Or vbInformation, "提示"
End Sub
Private Sub Form_Load()
cc.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\fdsw1.mmm;Jet OLEDB:Database Password=pianopan412424;Persist Security Info=False"
Dim temp As New ADODB.Recordset
Dim itmX As ListItem
temp.Open "select * from [user]", cc, 3, 2
For i = 1 To temp.RecordCount
ListView1.ListItems.Add , "S" & temp.Fields(0), temp.Fields(1), 1, 1
temp.MoveNext
Next
temp.Close
Call ListView1_ItemClick(ListView1.SelectedItem)
End Sub
Private Sub Form_Resize()
On Error GoTo 1
If Me.Width < 9915 Then Me.Width = 9915
If Me.Height < 6060 Then Me.Height = 6060
Picture2.Left = Me.Width - Picture2.Width - 50
Picture2.Top = Me.Height - Picture2.Height - 500
Picture1.Height = Me.Height - 500
ListView1.Height = Me.Height - 500
Frame1.Left = Me.Width - Frame1.Width - 200
ListView1.Width = Me.Width - Frame1.Width - Picture1.Width - 200
1
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
On Error GoTo 1
a = Right(Item.Key, Len(Item.Key) - 1)
Dim temp As New ADODB.Recordset
temp.Open "select * from [user] where [ID]=" & a, cc, 3, 2
If temp.RecordCount <> 0 Then
For i = 1 To 14
If temp.Fields(2 + i) = True Then Check1(i).Value = 1 Else Check1(i).Value = 0
Next
temp.Close
End If
1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -