⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form5.frm

📁 实现图书信息管理
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form5 
   Caption         =   "删除信息"
   ClientHeight    =   5640
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7260
   LinkTopic       =   "Form5"
   MaxButton       =   0   'False
   ScaleHeight     =   5640
   ScaleWidth      =   7260
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   495
      Left            =   5520
      TabIndex        =   5
      Top             =   1560
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "删除"
      Height          =   495
      Left            =   5520
      TabIndex        =   4
      Top             =   600
      Width           =   1575
   End
   Begin VB.Frame Frame1 
      Caption         =   "请选择要删除的对象"
      Height          =   5295
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4935
      Begin VB.ListBox List1 
         Height          =   4380
         ItemData        =   "Form5.frx":0000
         Left            =   120
         List            =   "Form5.frx":0002
         Sorted          =   -1  'True
         TabIndex        =   1
         Top             =   720
         Width           =   4695
      End
      Begin VB.Label Label2 
         Caption         =   "Label2"
         Height          =   255
         Left            =   1920
         TabIndex        =   3
         Top             =   360
         Width           =   1455
      End
      Begin VB.Label Label1 
         Caption         =   "Label1"
         Height          =   255
         Left            =   240
         TabIndex        =   2
         Top             =   360
         Width           =   1095
      End
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim response
Private Sub Command1_Click()
Dim s As String
Dim i As Integer
If Me.List1.Text = "" Then
   response = MsgBox("请选择要删除的对象", vbOKOnly + vbExclamation, "警告")
Else
   Set cmd.ActiveConnection = cnn
   i = InStr(List1.Text, " ")
   s = Left(List1.Text, i - 1)
   If del = 1 Then
    cmd.CommandText = "exec xs_delete " & "'" & s & "'"
   End If
   If del = 2 Then
    cmd.CommandText = "exec book_delete " & "'" & s & "'"
   End If
   cmd.Execute
   List1.RemoveItem List1.ListIndex
   response = MsgBox("删除成功", vbOKOnly + vbExclamation, "恭喜您")
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()

If del = 1 Then    '删除读者信息
Me.Label1.Caption = "借书证号"
Me.Label2.Caption = "姓名"
Set cmd.ActiveConnection = cnn
cmd.CommandText = "select 借书证号,姓名 from XS"
Set rs = cmd.Execute

rs.MoveFirst
Do While rs.EOF = False
   Me.List1.AddItem rs.Fields("借书证号") & "           " & rs.Fields("姓名")
   rs.MoveNext
Loop

End If

If del = 2 Then  '删除图书信息
Me.Label1.Caption = "ISBN"
Me.Label2.Caption = "书名"
Set cmd.ActiveConnection = cnn
cmd.CommandText = "select ISBN,书名 from BOOK"
Set rs = cmd.Execute

rs.MoveFirst
Do While rs.EOF = False
   Me.List1.AddItem rs.Fields("ISBN") & "   " & rs.Fields("书名")
   rs.MoveNext
Loop

End If

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -