📄 setuser.frm
字号:
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 = 375
Left = 4320
Top = 120
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 = "操作员设置"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim B As String
Private Sub Command1_Click()
If B = "TJYH" Then
If Text1.Text = "" Then MsgBox "用户名称不能为空!": Exit Sub
Adodc1.RecordSource = "select * from 操作员信息 where 用户名='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "此用户名称已经存在!"
Unload Me
操作员设置.Show
B = "TJYH"
Frame2.Enabled = True
Text1.SetFocus
Else
Adodc1.Recordset.AddNew '开辟一个存储空间,准备存储数据
Adodc1.Recordset.Fields(1) = Text1.Text
Adodc1.Recordset.Fields(2) = Text2.Text
If Check1.Value = 1 Then '判断用户权限设置
Adodc1.Recordset.Fields(3).Value = 1
Else
Adodc1.Recordset.Fields(3).Value = 0
End If
Adodc1.Recordset.Update '保存数据
MsgBox "系统操作用户添加成功!"
Adodc1.Refresh
Text1 = "": Text2 = ""
Frame2.Enabled = True
B = ""
Unload Me
操作员设置.Show
End If
ElseIf B = "SCYH" Then
If MsgBox("确定要删除名称为:" + Adodc1.Recordset.Fields(1) + "的用户吗?", vbYesNo + vbQuestion) = vbYes Then
Adodc1.Recordset.Delete
End If
DataGrid1.Enabled = False
B = ""
ElseIf B = "XGMM" Then
Adodc1.RecordSource = "select * from 操作员信息 where 用户名='" + Text1.Text + "'"
Adodc1.Refresh
Adodc1.Recordset.Fields("密码") = Text2.Text
Adodc1.Recordset.Update
MsgBox "密码修改成功!"
Adodc1.RecordSource = "select * from 操作员信息"
Adodc1.Refresh
DataGrid1.Enabled = False
Text1.Enabled = True
Frame2.Enabled = False
Text1.Text = ""
Text2.Text = ""
B = ""
ElseIf B = "QXSZ" Then
Adodc2.RecordSource = "select * from 操作员信息 where 用户名='" + Adodc1.Recordset.Fields(0) + "'"
Adodc2.Refresh
If Check1.Value = 1 Then Adodc2.Recordset.Fields(3).Value = 1
If Check1.Value = 0 Then Adodc2.Recordset.Fields(3).Value = 0
Adodc2.Recordset.Update
MsgBox "权限设置成功!"
Frame3.Enabled = False
DataGrid1.Enabled = False
B = ""
End If
End Sub
Private Sub Command2_Click()
系统主窗口.Enabled = True
Unload Me
End Sub
Private Sub DataGrid1_Click() '单击 DataGrid控件记录行,然后将其权限以Check控件显示出来
If B = "XGMM" Then
Text1.Text = Adodc1.Recordset.Fields(1)
End If
If B = "QXSZ" Then
Adodc2.RecordSource = "select * from 操作员信息 where 用户名='" + Adodc1.Recordset.Fields(1) + "'"
Adodc2.Refresh
Text1.Text = Adodc1.Recordset.Fields(1)
If Adodc2.Recordset.Fields(3).Value = 0 Then Check1.Value = 0 Else Check1.Value = 1
End If
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from 操作员信息"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
Adodc2.ConnectionString = PublicStr
Adodc2.RecordSource = "select 用户名 from 操作员信息"
Adodc2.Refresh
Frame2.Enabled = False
Frame3.Enabled = False
DataGrid1.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
系统主窗口.Enabled = True
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"
Frame2.Enabled = True
Text1.Text = ""
Text2.Text = ""
If Text1.Enabled = True Then Text1.SetFocus '使控件获得焦点
Frame3.Enabled = True
DataGrid1.Enabled = False
Case Is = "删除用户"
If B = "TJYH" And B = "XGMM" And B = "QXSZ" Then B = ""
B = "SCYH"
DataGrid1.Enabled = True
Frame2.Enabled = False
Frame3.Enabled = False
Case Is = "修改密码"
If B = "SCYH" And B = "TJYH" And B = "QXSZ" Then B = ""
Text1.Enabled = False
DataGrid1.Enabled = True
Frame2.Enabled = True
Frame3.Enabled = False
B = "XGMM"
Case Is = "权限设置"
If B = "SCYH" And B = "XGMM" And B = "TJYH" Then B = ""
Frame2.Enabled = False
Frame3.Enabled = True
DataGrid1.Enabled = True
B = "QXSZ"
End Select
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{TAB}"
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -