📄 form7.frm
字号:
VERSION 5.00
Begin VB.Form login6
Caption = "删除档案"
ClientHeight = 3735
ClientLeft = 60
ClientTop = 345
ClientWidth = 5955
LinkTopic = "Form7"
ScaleHeight = 3735
ScaleWidth = 5955
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3240
TabIndex = 5
Top = 2520
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "删除"
Height = 495
Left = 1320
TabIndex = 4
Top = 2520
Width = 1335
End
Begin VB.OptionButton Option2
Caption = "姓名"
Height = 495
Left = 480
TabIndex = 3
Top = 1440
Width = 975
End
Begin VB.OptionButton Option1
Caption = "学号"
Height = 495
Left = 480
TabIndex = 2
Top = 600
Width = 855
End
Begin VB.TextBox Text2
Height = 495
Left = 1800
TabIndex = 1
Top = 1440
Width = 3015
End
Begin VB.TextBox Text1
Height = 495
Left = 1800
TabIndex = 0
Top = 600
Width = 3015
End
End
Attribute VB_Name = "login6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim rs As ADODB.Recordset
Dim sql As String
On Error GoTo Command1_Click_Error
If (Text1.Text = "") And (Text2.Text = "") Then
MsgBox "请输入删除记录的学号或姓名", vbOKOnly + vbExclamation, "提示!"
Else
If Option1.Value = True Then
sql = "select * from students where 学号='" & Text1.Text & "'"
Else
sql = "select * from students where 姓名='" & Text2.Text & "'"
End If
Set rs = TransactSQL(sql)
If rs.EOF = True Then
MsgBox "无此记录", vbOKOnly + vbExclamation, "提示!"
Else
rs.delete
rs.Close
MsgBox "删除成功 vbOK ", vbOKOnly + vbExclamation, "提示!"
End If
End If
Text1.Text = ""
Text2.Text = ""
Command1_Click_Error:
Exit Sub
End Sub
Private Sub Command2_Click()
Unload Me
Exit Sub
End Sub
Private Sub Form_Load()
Text1.Enabled = False
Text2.Enabled = False
Option1.Value = False
Option2.Value = False
End Sub
Private Sub Option1_Click()
If Option1.Value = True Then
Text1.Enabled = True
Text2.Enabled = False
End If
End Sub
Private Sub Option2_Click()
If Option2.Value = True Then
Text2.Enabled = True
Text1.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -