📄 zygl.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomctl.ocx"
Begin VB.Form Zygl
Caption = "人员管理"
ClientHeight = 4560
ClientLeft = 60
ClientTop = 345
ClientWidth = 5295
ControlBox = 0 'False
Icon = "Zygl.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4560
ScaleWidth = 5295
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command4
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 3
Top = 3000
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "增加"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 2
Top = 840
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "修改"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 1
Top = 1560
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "删除"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 0
Top = 2280
Width = 1095
End
Begin MSComctlLib.ImageList ImageList1
Left = 4440
Top = 3900
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
UseMaskColor = 0 'False
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Zygl.frx":0442
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView TreeView1
Height = 4230
Left = 195
TabIndex = 4
Top = 150
Width = 3555
_ExtentX = 6271
_ExtentY = 7461
_Version = 393217
HideSelection = 0 'False
Style = 5
ImageList = "ImageList1"
BorderStyle = 1
Appearance = 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Attribute VB_Name = "Zygl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim mycommand As New ADODB.Command
Dim rst As New ADODB.Recordset
Private Sub Command1_Click()
ZYZJ.statr = "Add"
ZYZJ.Show 1
End Sub
Private Sub Command2_Click()
Dim str As String
str = InputBox("请输入原有密码", "提示")
If str = TreeView1.SelectedItem.Tag Then
ZYZJ.Text1.Tag = Mid(TreeView1.SelectedItem.Key, 2, Len(TreeView1.SelectedItem.Key))
ZYZJ.Text1.Text = TreeView1.SelectedItem.Text
ZYZJ.statr = "Edit"
ZYZJ.Show 1
End If
End Sub
Private Sub Command3_Click()
Dim str As String
If Mid(TreeView1.SelectedItem.Key, 2, Len(TreeView1.SelectedItem.Key)) = 1 Then
Exit Sub
End If
str = InputBox("请输入原有密码", "提示")
If str = TreeView1.SelectedItem.Tag Then
If conn.state = 0 Then
conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=SYS"
conn.Open
End If
mycommand.ActiveConnection = conn
mycommand.CommandText = "delete from MyUser where Id=" & Mid(TreeView1.SelectedItem.Key, 2, Len(TreeView1.SelectedItem.Key))
mycommand.Execute
conn.Close
End If
Call Datashow
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Call Datashow
End Sub
Sub Datashow()
Dim mynode As Node
On Error GoTo err:
If conn.state = 0 Then
conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=SYS"
conn.Open
End If
mycommand.ActiveConnection = conn
mycommand.CommandText = "select ID,UserName ,Pword from MyUser"
Set rst = mycommand.Execute
TreeView1.Nodes.clear
Set mynode = TreeView1.Nodes.Add(, , "人员管理", "人员管理", 1)
mynode.Expanded = True
While Not rst.EOF
Set mynode = TreeView1.Nodes.Add("人员管理", tvwChild, "Z" & rst.Fields(0).Value, rst.Fields(1).Value, 1)
mynode.Tag = rst.Fields(2)
mynode.Expanded = True
rst.MoveNext
Wend
conn.Close
Exit Sub
err:
MsgBox err.Description
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -