📄 frm_setop.frm
字号:
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改密码"
Key = "修改密码"
ImageIndex = 3
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "权限设置"
Key = "权限设置"
ImageIndex = 4
EndProperty
BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
EndProperty
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 5475
Top = 150
Visible = 0 'False
Width = 1995
_ExtentX = 3519
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_SSS"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_SSS"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select sysuser from tbS_power"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 5475
Top = 465
Visible = 0 'False
Width = 1995
_ExtentX = 3519
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_SSS"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_SSS"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select sysuser from tbS_power"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
End
Attribute VB_Name = "frm_setOP"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim B As String
Private Sub cmdExit_Click()
frm_main.Enabled = True
Unload Me
End Sub
Private Sub cmdsave_Click()
If B = "TJYH" Then
If Text1(0).Text = "" Then MsgBox "用户名称不能为空!": Exit Sub
Adodc1.RecordSource = "select * from tbS_power where sysuser='" + Text1(0).Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "此用户名称已经存在!"
Exit Sub '如果此用户名存在,将结束当前过程,从新添加一新用户名
Text1(0).Text = ""
Text1(0).SetFocus '使控件获得焦点
End If
Adodc1.Recordset.AddNew '开辟一个存储空间,准备存储数据
Adodc1.Recordset.Fields(0) = Text1(0).Text
Adodc1.Recordset.Fields(1) = Text1(1).Text
Adodc1.Recordset.Update '保存数据
MsgBox "系统操作用户添加成功!"
Adodc1.Refresh
Text1(0) = "": Text1(1) = ""
Frame1.Enabled = True
B = ""
ElseIf B = "SCYH" Then
If MsgBox("确定要删除用户名称为:" + Adodc1.Recordset.Fields(0) + "吗?", vbYesNo + vbQuestion) = vbYes Then
Adodc1.Recordset.Delete
End If
DataGrid1.Enabled = False
B = ""
ElseIf B = "XGMM" Then
Adodc1.RecordSource = "select * from tbS_power where sysuser='" + Text1(0).Text + "'"
Adodc1.Refresh
Adodc1.Recordset.Fields("password") = Text1(1).Text
Adodc1.Recordset.Update
MsgBox "密码修改成功!"
Adodc1.RecordSource = "select * from tbS_power"
Adodc1.Refresh
DataGrid1.Enabled = False
Text1(0).Enabled = True
Frame1.Enabled = False
Text1(0).Text = ""
Text1(1).Text = ""
B = ""
ElseIf B = "QXSZ" Then
Adodc2.RecordSource = "select * from tbS_power where sysuser='" + Adodc1.Recordset.Fields(0) + "'"
Adodc2.Refresh
For i = 2 To Check1.Count + 1
If Check1(i - 2).Value = 1 Then Adodc2.Recordset.Fields(i).Value = 1
If Check1(i - 2).Value = 0 Then Adodc2.Recordset.Fields(i).Value = 0
Adodc2.Recordset.Update
Next
MsgBox "权限设置成功!"
Frame2.Enabled = False
DataGrid1.Enabled = False
B = ""
End If
End Sub
'单击 DataGrid控件记录行,然后将其权限值 以Check控件中 显示出来
Private Sub DataGrid1_Click()
If B = "XGMM" Then
Text1(0).Text = Adodc1.Recordset.Fields(0)
End If
If B = "QXSZ" Then
Adodc2.RecordSource = "select * from tbS_power where sysuser='" + Adodc1.Recordset.Fields(0) + "'"
Adodc2.Refresh
Text1(0).Text = Adodc1.Recordset.Fields(0)
For i = 2 To Check1.Count + 1
If Adodc2.Recordset.Fields(i).Value = 0 Then Check1(i - 2).Value = 0 Else Check1(i - 2).Value = 1
Next i
End If
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select sysuser from tbS_power"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
Adodc2.ConnectionString = PublicStr
Adodc2.RecordSource = "select sysuser from tbS_power"
Adodc2.Refresh
Frame1.Enabled = False
Frame2.Enabled = False
DataGrid1.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{TAB}"
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case Is = "添加用户"
If B = "SCYH" And B = "XGMM" And B = "QXSZ" Then B = ""
B = "TJYH"
Frame1.Enabled = True
Text1(0).Text = ""
Text1(1).Text = ""
If Text1(0).Enabled = True Then Text1(0).SetFocus '使控件获得焦点
Frame2.Enabled = False
DataGrid1.Enabled = False
Case Is = "删除用户"
If B = "TJYH" And B = "XGMM" And B = "QXSZ" Then B = ""
B = "SCYH"
DataGrid1.Enabled = True
Frame1.Enabled = False
Frame2.Enabled = False
Case Is = "修改密码"
If B = "SCYH" And B = "TJYH" And B = "QXSZ" Then B = ""
Text1(0).Enabled = False
DataGrid1.Enabled = True
Frame1.Enabled = True
Frame2.Enabled = False
B = "XGMM"
Case Is = "权限设置"
If B = "SCYH" And B = "XGMM" And B = "TJYH" Then B = ""
Frame2.Enabled = True
DataGrid1.Enabled = True
Frame1.Enabled = False
B = "QXSZ"
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -