📄 管理员信息.frm
字号:
ForeColor = &H00FF0000&
Height = 180
Left = 840
TabIndex = 64
Top = 3360
Width = 270
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "[*]"
ForeColor = &H00FF0000&
Height = 180
Left = 1080
TabIndex = 63
Top = 2400
Width = 270
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "[*]"
ForeColor = &H00FF0000&
Height = 180
Left = 1440
TabIndex = 62
Top = 480
Width = 270
End
Begin VB.Label Label34
AutoSize = -1 'True
Caption = "邮件"
Height = 195
Left = 4800
TabIndex = 15
Top = 3360
Width = 360
End
Begin VB.Label Label35
Caption = "电话"
Height = 255
Left = 4800
TabIndex = 14
Top = 2400
Width = 735
End
Begin VB.Label Label36
AutoSize = -1 'True
Caption = "联系地址"
Height = 195
Left = 4680
TabIndex = 13
Top = 1440
Width = 720
End
Begin VB.Label Label37
AutoSize = -1 'True
Caption = "管理员类型"
Height = 195
Left = 4680
TabIndex = 12
Top = 480
Width = 900
End
Begin VB.Label Label39
AutoSize = -1 'True
Caption = "密码"
Height = 195
Left = 480
TabIndex = 11
Top = 3360
Width = 360
End
Begin VB.Label Label41
AutoSize = -1 'True
Caption = "证件号"
Height = 195
Left = 480
TabIndex = 10
Top = 2400
Width = 540
End
Begin VB.Label Label42
AutoSize = -1 'True
Caption = "姓名"
Height = 195
Left = 480
TabIndex = 9
Top = 1440
Width = 360
End
Begin VB.Label Label43
AutoSize = -1 'True
Caption = "管理员编号"
Height = 195
Left = 480
TabIndex = 8
Top = 480
Width = 900
End
End
End
Begin VB.Menu file
Caption = "文件"
Begin VB.Menu huiyua
Caption = "会员信息"
End
Begin VB.Menu exit
Caption = "退出"
End
End
End
Attribute VB_Name = "管理员信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo ErrorHandle:
Dim sql As String
sql = "delete from Admin_Info "
sql = sql + "where AdminID = '" + txtAdmin_card2.Text + "'and "
sql = sql + "Admin_name = '" + txtAdmin_name2.Text + "' and "
sql = sql + "IdentityID = '" + txtAdmin_ID2.Text + "'"
Form1.cnTest.Execute (sql)
MsgBox "修改资料成功!", vbOKOnly, "操作信息"
Exit Sub
ErrorHandle:
Select Case (Err.Number)
Case -2147217873:
MsgBox "会员编号已存在,或管理员编号不存在!", vbExclamation, "错误"
Case -2147217913:
MsgBox "某些数据格式不正确!", vbExclamation, "错误"
Case -2147217833:
MsgBox "某些数据超过存储范围请缩小其值", vbExclamation, "错误"
Case Else:
MsgBox Err.Number & vbCrLf & Err.Description, vbExclamation, "Error"
End Select
On Error GoTo 0
Exit Sub
End Sub
Private Sub Command10_Click()
Unload 管理员信息
End Sub
Private Sub Command11_Click()
On Error GoTo ErrorHandle:
If txtAdmin_card.Text = "" Or txtAdmin_ID.Text = "" Or txtAdmin_password.Text = "" Or txtAdmin_type.Text = "" Then
MsgBox "带星号的位置不能为空!", vbOKOnly, "错误!"
Exit Sub
End If
Dim sql As String
sql = "insert into Admin_Info values( '"
sql = sql + txtAdmin_card.Text + "','"
sql = sql + txtAdmin_name.Text + "','"
sql = sql + txtAdmin_password.Text + "','"
sql = sql + txtAdmin_type.Text + "','"
sql = sql + txtAdmin_ID.Text + "','"
sql = sql + txtAdmin_tel.Text + "','"
sql = sql + txtAdmin_mail.Text + "','"
sql = sql + txtAdmin_addr.Text + "')"
Form1.cnTest.Execute (sql)
MsgBox "添加资料成功!", vbOKOnly, "操作信息"
Exit Sub
ErrorHandle:
Select Case (Err.Number)
Case -2147217873:
MsgBox "会员编号已存在,或管理员编号不存在!", vbExclamation, "错误"
Case -2147217913:
MsgBox "某些数据格式不正确!", vbExclamation, "错误"
Case -2147217833:
MsgBox "某些数据超过存储范围请缩小其值", vbExclamation, "错误"
Case Else:
MsgBox Err.Number & vbCrLf & Err.Description, vbExclamation, "Error"
End Select
On Error GoTo 0
Exit Sub
End Sub
Private Sub Command12_Click()
Dim sql As String
sql = "select * from Admin_Info where AdminID like "
sql = sql + "'%" + txtAdmin_card1.Text + "%' and "
sql = sql + "Admin_name like '%" + txtAdmin_name1 + "%' and "
sql = sql + "IdentityID like '%" + txtAdmin_ID1 + "%'"
Set cnRecordSet = Form1.cnTest.Execute(sql)
If cnRecordSet.EOF = True Then
MsgBox "没有该条记录", vbOKOnly, "错误!"
Exit Sub
End If
Dim item As ListItem
ListView2.ListItems.Clear
Do While cnRecordSet.EOF = False
Set item = ListView2.ListItems.Add
If cnRecordSet.Fields.item(0).Value <> "" Then
item.Text = cnRecordSet.Fields.item(0).Value
End If
If cnRecordSet.Fields.item(1).Value <> "" Then
item.SubItems(1) = cnRecordSet.Fields.item(1).Value
End If
If cnRecordSet.Fields.item(2).Value <> "" Then
item.SubItems(2) = cnRecordSet.Fields.item(2).Value
End If
If cnRecordSet.Fields.item(3).Value <> "" Then
item.SubItems(3) = cnRecordSet.Fields.item(3).Value
End If
If cnRecordSet.Fields.item(4).Value <> "" Then
item.SubItems(4) = cnRecordSet.Fields.item(4).Value
End If
If cnRecordSet.Fields.item(5).Value <> "" Then
item.SubItems(5) = cnRecordSet.Fields.item(5).Value
End If
If cnRecordSet.Fields.item(6).Value <> "" Then
item.SubItems(6) = cnRecordSet.Fields.item(6).Value
End If
If cnRecordSet.Fields.item(7).Value <> "" Then
item.SubItems(7) = cnRecordSet.Fields.item(7).Value
End If
cnRecordSet.MoveNext
Loop
End Sub
Private Sub Command13_Click()
txtAdmin_card1.Text = ""
txtAdmin_name1.Text = ""
txtAdmin_ID1.Text = ""
End Sub
Private Sub Command14_Click()
If txtAdmin_card2.Text = "" And txtAdmin_ID2.Text = "" Then
MsgBox "请输入管理员号或证件号中的至少一个", vbOKOnly, "警告!"
Exit Sub
End If
Dim sql As String
sql = "select * from Admin_Info where AdminID like "
sql = sql + "'%" + txtAdmin_card2.Text + "%' and "
sql = sql + "Admin_name like '%" + txtAdmin_name2.Text + "%' and "
sql = sql + "IdentityID like '%" + txtAdmin_ID2.Text + "%'"
Set cnRecordSet = Form1.cnTest.Execute(sql)
If cnRecordSet.EOF = True Then
MsgBox "没有该条记录", vbOKOnly
Key = 0
Exit Sub
End If
If cnRecordSet.Fields.item(0).Value <> "" Then
txtAdmin_Card3.Text = cnRecordSet.Fields.item(0).Value
txtAdmin_card2 = cnRecordSet.Fields.item(0).Value
End If
If cnRecordSet.Fields.item(1).Value <> "" Then
txtAdmin_name3.Text = cnRecordSet.Fields.item(1).Value
txtAdmin_name2.Text = cnRecordSet.Fields.item(1).Value
End If
If cnRecordSet.Fields.item(4).Value <> "" Then
txtAdmin_ID3.Text = cnRecordSet.Fields.item(4).Value
txtAdmin_ID2.Text = cnRecordSet.Fields.item(4).Value
End If
If cnRecordSet.Fields.item(3).Value <> "" Then
txtAdmin_type1.Text = cnRecordSet.Fields.item(3).Value
End If
If cnRecordSet.Fields.item(7).Value <> "" Then
txtAdmin_addr1.Text = cnRecordSet.Fields.item(7).Value
End If
If cnRecordSet.Fields.item(5).Value <> "" Then
txtAdmin_tel1.Text = cnRecordSet.Fields.item(5).Value
End If
If cnRecordSet.Fields.item(6).Value <> "" Then
txtAdmin_mail1.Text = cnRecordSet.Fields.item(6).Value
End If
If cnRecordSet.Fields.item(2).Value <> "" Then
txtAdmin_password1.Text = cnRecordSet.Fields.item(2).Value
End If
Command15.Enabled = True
Command1.Enabled = True
End Sub
Private Sub Command15_Click()
On Error GoTo ErrorHandle:
Dim sql As String
sql = "delete from Admin_Info "
sql = sql + "where AdminID = '" + txtAdmin_card2.Text + "'and "
sql = sql + "Admin_name = '" + txtAdmin_name2.Text + "' and "
sql = sql + "IdentityID = '" + txtAdmin_ID2.Text + "'"
Form1.cnTest.Execute (sql)
sql = ""
sql = "insert into Admin_Info values( '"
sql = sql + txtAdmin_Card3.Text + "','"
sql = sql + txtAdmin_name3.Text + "','"
sql = sql + txtAdmin_password1.Text + "','"
sql = sql + txtAdmin_type1.Text + "','"
sql = sql + txtAdmin_ID3.Text + "','"
sql = sql + txtAdmin_tel1.Text + "','"
sql = sql + txtAdmin_mail1.Text + "','"
sql = sql + txtAdmin_addr1.Text + "') "
Form1.cnTest.Execute (sql)
MsgBox "修改资料成功!", vbOKOnly, "操作信息"
Exit Sub
ErrorHandle:
Select Case (Err.Number)
Case -2147217873:
MsgBox "会员编号已存在,或管理员编号不存在!", vbExclamation, "错误"
Case -2147217913:
MsgBox "某些数据格式不正确!", vbExclamation, "错误"
Case -2147217833:
MsgBox "某些数据超过存储范围请缩小其值", vbExclamation, "错误"
Case Else:
MsgBox Err.Number & vbCrLf & Err.Description, vbExclamation, "Error"
End Select
On Error GoTo 0
Exit Sub
End Sub
Private Sub Command16_Click()
Command15.Enabled = False
Command1.Enabled = False
txtAdmin_card2.Text = ""
txtAdmin_Card3.Text = ""
txtAdmin_name2.Text = ""
txtAdmin_name3.Text = ""
txtAdmin_ID2.Text = ""
txtAdmin_ID3.Text = ""
txtAdmin_password1.Text = ""
txtAdmin_type1.Text = ""
txtAdmin_tel1.Text = ""
txtAdmin_mail1.Text = ""
txtAdmin_addr1.Text = ""
End Sub
Private Sub Command9_Click()
txtAdmin_card.Text = ""
txtAdmin_name.Text = ""
txtAdmin_ID.Text = ""
txtAdmin_password.Text = ""
txtAdmin_type.Text = ""
txtAdmin_addr.Text = ""
txtAdmin_tel.Text = ""
txtAdmin_mail.Text = ""
End Sub
Private Sub huiyua_Click()
Form3.Hide
Form2.Show
End Sub
Private Sub ListView2_DblClick()
txtAdmin_Card3.Text = ListView2.SelectedItem.Text
txtAdmin_card2.Text = ListView2.SelectedItem.Text
txtAdmin_name3.Text = ListView2.SelectedItem.SubItems(1)
txtAdmin_name2.Text = ListView2.SelectedItem.SubItems(1)
txtAdmin_ID3.Text = ListView2.SelectedItem.SubItems(4)
txtAdmin_ID2.Text = ListView2.SelectedItem.SubItems(4)
txtAdmin_type1.Text = ListView2.SelectedItem.SubItems(3)
txtAdmin_addr1.Text = ListView2.SelectedItem.SubItems(7)
txtAdmin_tel1.Text = ListView2.SelectedItem.SubItems(5)
txtAdmin_mail1.Text = ListView2.SelectedItem.SubItems(6)
SSTab1.Tab = 2
Command15.Enabled = True
Command1.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -