📄 frmbookdelete.frm
字号:
VERSION 5.00
Begin VB.Form frmBookDelete
Caption = "删除书籍信息"
ClientHeight = 2700
ClientLeft = 60
ClientTop = 450
ClientWidth = 4650
LinkTopic = "Form7"
ScaleHeight = 2700
ScaleWidth = 4650
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 2520
TabIndex = 3
Top = 1560
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 960
TabIndex = 2
Top = 1560
Width = 1095
End
Begin VB.TextBox txtNumber
Height = 375
Left = 960
TabIndex = 1
Top = 840
Width = 2415
End
Begin VB.Label Label1
Caption = "请输入你要删除的书的编号"
Height = 375
Left = 480
TabIndex = 0
Top = 240
Width = 2415
End
End
Attribute VB_Name = "frmBookDelete"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim conn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Dim N As Boolean
N = True
If Trim(txtNumber.Text) = "" Then
MsgBox "书籍编号不能为空", vbOKOnly + vbExclamation, ""
txtNumber.SetFocus
N = False
End If
If N = True Then
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=book.mdb;Persist Security Info=False"
conn.Open
sql = "select*from BookInfo where BookNumber = '"
sql = sql + txtNumber.Text + "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
MsgBox "书籍编号不存在,请检查!"
N = False
End If
rs.Close
End If
If N = True Then
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
rs.Delete
rs.Update
rs.Close
MsgBox "删除书目成功!"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -