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

📄 frmaddbookinfo.frm

📁 图书管理系统vb源代码。里面有毕业论文和图书管理系统vb源代码。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmaddbookinfo 
   Caption         =   "添加图书信息"
   ClientHeight    =   5625
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8235
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   ScaleHeight     =   5625
   ScaleWidth      =   8235
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdCancle 
      Caption         =   "取消"
      Height          =   495
      Left            =   4560
      TabIndex        =   16
      Top             =   4680
      Width           =   1215
   End
   Begin VB.CommandButton CmdOK 
      Caption         =   "确定"
      Height          =   495
      Left            =   1800
      TabIndex        =   15
      Top             =   4680
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Height          =   3855
      Left            =   480
      TabIndex        =   0
      Top             =   240
      Width           =   7335
      Begin VB.TextBox txtDate 
         Height          =   375
         Left            =   5040
         TabIndex        =   14
         Top             =   2160
         Width           =   1335
      End
      Begin VB.TextBox txtPbDate 
         Height          =   375
         Left            =   5040
         TabIndex        =   12
         Top             =   1560
         Width           =   1335
      End
      Begin VB.TextBox txtAuther 
         Height          =   375
         Left            =   1080
         TabIndex        =   9
         Top             =   2160
         Width           =   1335
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1080
         TabIndex        =   8
         Text            =   "选择类别"
         Top             =   1560
         Width           =   1335
      End
      Begin VB.TextBox txtPb 
         Height          =   375
         Left            =   1080
         TabIndex        =   7
         Top             =   2760
         Width           =   1335
      End
      Begin VB.TextBox txtName 
         Height          =   375
         Left            =   1080
         TabIndex        =   4
         Top             =   960
         Width           =   5295
      End
      Begin VB.TextBox txtID 
         Height          =   375
         Left            =   1080
         TabIndex        =   2
         Top             =   240
         Width           =   1335
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "登记日期"
         Height          =   180
         Left            =   4080
         TabIndex        =   13
         Top             =   2160
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "出版日期"
         Height          =   180
         Left            =   4080
         TabIndex        =   11
         Top             =   1560
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "出版社"
         Height          =   180
         Left            =   360
         TabIndex        =   10
         Top             =   2760
         Width           =   540
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "作者"
         Height          =   180
         Left            =   480
         TabIndex        =   6
         Top             =   2160
         Width           =   360
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "类别"
         Height          =   180
         Left            =   480
         TabIndex        =   5
         Top             =   1560
         Width           =   360
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "书名"
         Height          =   180
         Left            =   480
         TabIndex        =   3
         Top             =   960
         Width           =   360
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "图书编号"
         Height          =   180
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   720
      End
   End
End
Attribute VB_Name = "frmaddbookinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdOK_Click()
Dim rs_addbook As New ADODB.Recordset
Dim sql As String
If Trim(Combo1.Text) = "" Then
   MsgBox "请选择图书种类", vbOKOnly + vbExclamation, ""
   Combo1.SetFocus
   Exit Sub
End If
If Trim(txtID.Text) = "" Then
   MsgBox "图书编号不能为空", vbOKOnly + vbExclamation, ""
   txtID.SetFocus
   Exit Sub
End If
If Trim(txtName.Text) = "" Then
   MsgBox "书名不能为空", vbOKOnly + vbExclamation, ""
   txtName.SetFocus
   Exit Sub
End If
   If Not IsDate(txtPbDate.Text) Then
      MsgBox "请按照yyyy-mm-dd格式输入日期", vbOKOnly + vbExclamation, ""
      txtPbDate.SetFocus
      Exit Sub
   End If
   If Not IsDate(txtDate.Text) Then
      MsgBox "请按照yyyy-mm-dd格式输入日期", vbOKOnly + vbExclamation, ""
      txtDate.SetFocus
      Exit Sub
   End If
sql = "select * from 书籍信息 where 书籍编号='" & txtID.Text & "'"
rs_addbook.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_addbook.EOF Then
   rs_addbook.AddNew
   rs_addbook.Fields(0) = Trim(txtID.Text)
   rs_addbook.Fields(1) = Trim(txtName.Text)
   rs_addbook.Fields(2) = Trim(Combo1.Text)
   rs_addbook.Fields(3) = Trim(txtAuther.Text)
   rs_addbook.Fields(4) = Trim(txtPb.Text)
   rs_addbook.Fields(5) = Trim(txtPbDate.Text)
   rs_addbook.Fields(6) = Trim(txtDate.Text)
   rs_addbook.Fields(7) = "否"
   rs_addbook.Update
   MsgBox "添加书籍信息成功!", vbOKOnly, ""
   rs_addbook.Close
Else
   MsgBox "图书编号重复!", vbOKOnly + vbExclamation, ""
   txtID.SetFocus
   txtID.Text = ""
   rs_addbook.Close
   Exit Sub
End If

End Sub

Private Sub cmdCancle_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim rs_leibie As New ADODB.Recordset
Dim sql As String
sql = "select * from 图书类别"
rs_leibie.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_leibie.MoveFirst
Do While Not rs_leibie.EOF
  Combo1.AddItem rs_leibie.Fields(0)
  rs_leibie.MoveNext
Loop
rs_leibie.Close
End Sub

⌨️ 快捷键说明

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