📄 frmadminlist.frm
字号:
VERSION 5.00
Begin VB.Form frmAdminList
BorderStyle = 1 'Fixed Single
Caption = "管理员列表"
ClientHeight = 3495
ClientLeft = 45
ClientTop = 330
ClientWidth = 5340
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3495
ScaleWidth = 5340
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frmAdminList.frx":0000
Left = 3960
List = "frmAdminList.frx":000A
TabIndex = 13
Text = "-用户类型-"
Top = 1440
Visible = 0 'False
Width = 1215
End
Begin VB.TextBox Text3
Height = 375
Left = 2160
TabIndex = 12
Top = 1440
Width = 1695
End
Begin VB.CommandButton cancel_comm
Caption = "取消"
Height = 495
Left = 3240
TabIndex = 10
Top = 2760
Width = 1215
End
Begin VB.CommandButton Save_Comm
Caption = "保存"
Enabled = 0 'False
Height = 495
Left = 1800
TabIndex = 9
Top = 2760
Width = 1215
End
Begin VB.CommandButton Edit_Comm
Caption = "修改"
Enabled = 0 'False
Height = 495
Left = 360
TabIndex = 8
Top = 2760
Width = 1215
End
Begin VB.CommandButton Last_Comm
Caption = ">>"
Enabled = 0 'False
Height = 375
Left = 3720
TabIndex = 7
Top = 2160
Width = 735
End
Begin VB.CommandButton Next_Comm
Caption = ">"
Enabled = 0 'False
Height = 375
Left = 2640
TabIndex = 6
Top = 2160
Width = 735
End
Begin VB.CommandButton Previous_Comm
Caption = "<"
Enabled = 0 'False
Height = 375
Left = 1440
TabIndex = 5
Top = 2160
Width = 735
End
Begin VB.CommandButton First_Comm
Caption = "<<"
Enabled = 0 'False
Height = 375
Left = 360
TabIndex = 4
Top = 2160
Width = 735
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 2160
PasswordChar = "*"
TabIndex = 3
Text = "Text2"
Top = 840
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 2160
TabIndex = 1
Top = 240
Width = 1695
End
Begin VB.Label Label3
Caption = "权限:"
Height = 375
Left = 720
TabIndex = 11
Top = 1560
Width = 1095
End
Begin VB.Label Label2
Caption = "密码:"
Height = 495
Left = 720
TabIndex = 2
Top = 960
Width = 1215
End
Begin VB.Label Label1
Caption = "名字:"
Height = 495
Left = 720
TabIndex = 0
Top = 240
Width = 1215
End
End
Attribute VB_Name = "frmAdminList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New Class1
Dim rs As New ADODB.Recordset
Dim myid As Integer
Private Sub cancel_comm_Click()
Unload frmAdminList
End Sub
Private Sub Edit_Comm_Click()
If MsgBox("如果修改成普通用户必需要重新登录", vbQuestion + vbYesNo) = vbYes Then
Save_Comm.Enabled = True
Combo1.Visible = True
End If
End Sub
Private Sub First_Comm_Click()
If rs.State = 1 Then
If Not rs.BOF Then
rs.MoveFirst
If rs.BOF Then Exit Sub
Text1.Text = rs("user_name")
Text2.Text = rs("user_password")
If rs("popedom") = 1 Then
Text3.Text = "超级管理员"
Else
Text3.Text = "普通用户"
End If
myid = rs("id")
End If
End If
End Sub
Private Sub Last_Comm_Click()
If rs.State = 2 Then Exit Sub
If rs.EOF Then Exit Sub
rs.MoveLast
If rs.EOF Then Exit Sub
Text1.Text = rs("user_name")
Text2.Text = rs("user_password")
If rs("popedom") = 1 Then
Text3.Text = "超级管理员"
Else
Text3.Text = "普通用户"
End If
myid = rs("id")
End Sub
Private Sub Next_Comm_Click()
If rs.State = 1 Then
If rs.EOF Then Exit Sub
rs.MoveNext
If rs.EOF Then Exit Sub
Text1.Text = rs("user_name")
Text2.Text = rs("user_password")
If rs("popedom") = 1 Then
Text3.Text = "超级管理员"
Else
Text3.Text = "普通用户"
End If
myid = rs("id")
End If
End Sub
Private Sub Form_Load()
If conn.ocn.State = False Then
conn.OpenData
End If
If rs.State = 1 Then
rs.Close
End If
rs.Open "select*from admin", conn.ocn, 1, 1
If rs.EOF And rs.BOF Then
MsgBox "no data"
Exit Sub
End If
Text1.Text = rs("user_name")
Text2.Text = rs("user_password")
If rs("popedom") = 1 Then
Text3.Text = "超级管理员"
Else
Text3.Text = "普通用户"
End If
myid = rs("id")
First_Comm.Enabled = True
Previous_Comm.Enabled = True
Next_Comm.Enabled = True
Last_Comm.Enabled = True
Edit_Comm.Enabled = True
'Save_Comm.Enabled = True
End Sub
Private Sub Previous_Comm_Click()
If rs.State = 2 Then Exit Sub
If rs.BOF Then Exit Sub
rs.MovePrevious
If rs.BOF Then Exit Sub
Text1.Text = rs("user_name")
Text2.Text = rs("user_password")
If rs("popedom") = 1 Then
Text3.Text = "超级管理员"
Else
Text3.Text = "普通用户"
End If
myid = rs("id")
End Sub
Private Sub Save_Comm_Click()
Dim mypopedom As Integer
If Combo1.Text = "管理员" Then
mypopedom = 1
Else
mypopedom = 0
End If
conn.ocn.Execute "update admin set user_name='" & Trim(Text1.Text) & "',user_password='" & Trim(Text2.Text) & "',popedom='" & mypopedom & "' where id=" & myid
If mypopedom = 0 Then
Unload MDIForm1
frmLogin.Show
End If
Unload frmAdminList
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -