📄 admin.frm
字号:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "备 注:"
Height = 180
Left = 120
TabIndex = 8
Top = 1860
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "确认口令:"
Height = 180
Left = 120
TabIndex = 6
Top = 1380
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "口 令:"
Height = 180
Left = 120
TabIndex = 4
Top = 900
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用 户 名:"
Height = 180
Left = 120
TabIndex = 2
Top = 420
Width = 900
End
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSG1
Height = 3855
Left = 120
TabIndex = 0
Top = 3000
Width = 9495
_ExtentX = 16748
_ExtentY = 6800
_Version = 393216
AllowUserResizing= 1
_NumberOfBands = 1
_Band(0).Cols = 2
End
End
Attribute VB_Name = "Admin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Conn As New ADODB.Connection
Private Rs As New ADODB.Recordset
Private Selrow As Integer
Private Sub Form_Load()
MSG1.SelectionMode = flexSelectionByRow
MSG1.FocusRect = flexFocusNone
MSG1.HighLight = flexHighlightWithFocus
MSG1.ColWidth(0) = 200
MSG1.Cols = 5
MSG1.ColWidth(1) = 1600
MSG1.ColWidth(2) = 1600
MSG1.ColWidth(3) = 1600
MSG1.ColWidth(4) = 2200
For i = 0 To MSG1.Cols - 1
MSG1.ColAlignmentFixed(i) = 4
Next
MSG1.TextMatrix(0, 1) = "用户名"
MSG1.TextMatrix(0, 2) = "口令"
MSG1.TextMatrix(0, 3) = "权限"
MSG1.TextMatrix(0, 4) = "备注"
If Conn.State = 1 Then Conn.Close
DBname = App.Path & "\xjdb.dll"
DBpass = "www.ahxc.net"
DBconn
Conn.Open Connstr
Sql = "select * from xjuser"
If Rs.State = 1 Then Rs.Close
Rs.Open Sql, Conn, 1, 1
If Not (Rs.EOF And Rs.BOF) Then
MSG1.Rows = Rs.RecordCount + 1
For i = 1 To Rs.RecordCount
For j = 1 To Rs.Fields.Count - 1
If j = 2 Then
MSG1.TextMatrix(i, j) = "###"
Else
MSG1.TextMatrix(i, j) = Rs(j)
End If
Next
Rs.MoveNext
Next
If Rs.State = 1 Then Rs.Close
End If
End Sub
Private Sub Form_Resize()
MSG1.Height = 3855 + Me.Height - 7425
MSG1.Width = 9495 + Me.Width - 9870
End Sub
Private Sub MSG1_Click()
MSG1_SelChange
End Sub
Private Sub MSG1_SelChange()
If MSG1.TextMatrix(1, 1) = "" Then Exit Sub
VbTextEx1.Text = MSG1.TextMatrix(MSG1.Row, 1)
VbTextEx4.Text = MSG1.TextMatrix(MSG1.Row, 4)
yy = Split(MSG1.TextMatrix(MSG1.Row, 3), ",")
For i = 0 To flag.UBound
flag(i).Value = CInt(yy(i))
Next
Selrow = MSG1.Row
VbTextEx1.Locked = True
End Sub
Private Sub xpCommand1_Click()
If VbTextEx1.Locked = True Then
VbTextEx1.Locked = False
VbTextEx1.Text = ""
VbTextEx2.Text = ""
VbTextEx3.Text = ""
VbTextEx4.Text = ""
For i = 0 To flag.UBound
flag(i).Value = 0
Next
Exit Sub
End If
If VbTextEx1.Text = "" Then MsgBox "请输入用户名!", 0 + 48 + 0: Exit Sub
If VbTextEx2.Text = "" Or VbTextEx3.Text = "" Or VbTextEx2.Text <> VbTextEx3.Text Then
MsgBox "请正确输入口令!", 0 + 48 + 0
VbTextEx2.SetFocus
Exit Sub
End If
DD = 0
AA = ""
For i = 0 To flag.UBound
If AA = "" Then
AA = CStr(flag(i).Value)
Else
AA = AA + "," + CStr(flag(i).Value)
End If
Next
If Conn.State = 1 Then
Sql = "select * from xjuser where username='" & Trim(VbTextEx1.Text) & "'"
If Rs.State = 1 Then Rs.Close
Rs.Open Sql, Conn, 1, 3
If Not (Rs.EOF And Rs.BOF) Then
MsgBox "要添加的操作员已经存在!", 0 + 48 + 0
Exit Sub
Else
Rs.AddNew
Rs("username") = Trim(VbTextEx1.Text)
Rs("passs") = MD5.MD5(VbTextEx2.Text, 32)
Rs("flags") = AA
Rs("memo") = Trim(VbTextEx4.Text)
Rs.Update
Rs.Close
End If
End If
If MSG1.TextMatrix(1, 1) <> "" Then
MSG1.Rows = MSG1.Rows + 1
DD = MSG1.Rows - 1
Else
DD = 1
End If
MSG1.TextMatrix(DD, 1) = Trim(VbTextEx1.Text)
MSG1.TextMatrix(DD, 2) = "###"
MSG1.TextMatrix(DD, 3) = AA
MSG1.TextMatrix(DD, 4) = Trim(VbTextEx4.Text)
MsgBox "[" + Trim(VbTextEx1.Text) + "],用户添加成功!", 0 + 48 + 0
VbTextEx1.Text = ""
VbTextEx2.Text = ""
VbTextEx3.Text = ""
VbTextEx4.Text = ""
For i = 0 To flag.UBound
flag(i).Value = 0
Next
End Sub
Private Sub xpCommand2_Click()
DD = 0
If VbTextEx1.Locked = False Then Exit Sub
If Selrow = 0 Then Exit Sub
AA = ""
For i = 0 To flag.UBound
If AA = "" Then
AA = CStr(flag(i).Value)
Else
AA = AA + "," + CStr(flag(i).Value)
End If
Next
If VbTextEx2.Text <> VbTextEx3.Text Then
MsgBox "请正确输入口令!", 0 + 48 + 0
VbTextEx2.SetFocus
Exit Sub
End If
s = Selrow
Sql = "select * from xjuser where username='" & Trim(VbTextEx1.Text) & "'"
If Conn.State = 1 Then
Else
Conn.Open Connstr
End If
If Rs.State = 1 Then Rs.Close
Rs.Open Sql, Conn, 1, 3
If Not (Rs.EOF And Rs.BOF) Then
Rs("username") = Trim(VbTextEx1.Text)
If VbTextEx2.Text <> "" Then Rs("passs") = MD5.MD5((VbTextEx2.Text), 32)
Rs("flags") = AA
Rs("memo") = Trim(VbTextEx4.Text)
Rs.Update
If Rs.State = 1 Then Rs.Close
Else
MsgBox "操作员不存在!", 0 + 48 + 0
If Rs.State = 1 Then Rs.Close
Exit Sub
End If
If MSG1.TextMatrix(1, 1) <> "" Then
DD = Selrow
Else
DD = 1
End If
MSG1.TextMatrix(DD, 1) = Trim(VbTextEx1.Text)
MSG1.TextMatrix(DD, 2) = "###"
MSG1.TextMatrix(DD, 3) = AA
MSG1.TextMatrix(DD, 4) = Trim(VbTextEx4.Text)
MsgBox "[" + Trim(VbTextEx1.Text) + "],用户修改成功!", 0 + 48 + 0
VbTextEx1.Locked = False
VbTextEx1.Text = ""
VbTextEx2.Text = ""
VbTextEx3.Text = ""
VbTextEx4.Text = ""
For i = 0 To flag.UBound
flag(i).Value = 0
Next
End Sub
Private Sub xpCommand3_Click()
'On Error Resume Next
If MSG1.TextMatrix(1, 1) = "" Then Exit Sub
AA = MsgBox("你是否真得删除[" & MSG1.TextMatrix(MSG1.RowSel, 1) & "]信息?", vbQuestion + vbYesNo)
If AA = vbNo Then Exit Sub
Sql = "delete from xjuser where username='" & Trim(MSG1.TextMatrix(MSG1.RowSel, 1)) & "'"
'MsgBox Sql
If Conn.State = 1 Then Conn.Execute Sql
If MSG1.Rows > 2 Then
MSG1.RemoveItem (MSG1.RowSel)
Else
For s = 1 To MSG1.Cols - 1
MSG1.TextMatrix(1, s) = ""
Next
End If
Selrow = 0
VbTextEx1.Text = ""
VbTextEx2.Text = ""
VbTextEx3.Text = ""
VbTextEx4.Text = ""
For i = 0 To flag.UBound
flag(i).Value = 0
Next
MsgBox "信息删除成功!", 0 + 48 + 0
End Sub
Private Sub xpCommand4_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -