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

📄 addbook.frm

📁 图书管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form addeditbook 
   Caption         =   "图书入库信息登记"
   ClientHeight    =   5235
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5070
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   9.75
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   5235
   ScaleWidth      =   5070
   StartUpPosition =   2  'CenterScreen
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   3000
      Top             =   0
      Visible         =   0   'False
      Width           =   1575
      _ExtentX        =   2778
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "driver={sql server};server=localhost;database=library_mis;uid=sa;pwd="
      OLEDBString     =   "driver={sql server};server=localhost;database=library_mis;uid=sa;pwd="
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select distinct bookpub from books"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton cmdcancel 
      Caption         =   "取消"
      Height          =   495
      Left            =   2760
      TabIndex        =   14
      Top             =   4560
      Width           =   855
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确定"
      Height          =   495
      Left            =   1320
      TabIndex        =   13
      Top             =   4560
      Width           =   855
   End
   Begin VB.Frame Frame1 
      Caption         =   "图书信息"
      Height          =   3975
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   4215
      Begin VB.TextBox txtprice 
         Height          =   375
         Left            =   840
         TabIndex        =   12
         Top             =   3360
         Width           =   1455
      End
      Begin VB.TextBox txtpubdate 
         Height          =   375
         Left            =   1200
         TabIndex        =   10
         Top             =   2760
         Width           =   2175
      End
      Begin MSDataListLib.DataCombo datacombo1 
         Bindings        =   "addbook.frx":0000
         Height          =   345
         Left            =   1080
         TabIndex        =   8
         Top             =   2160
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   609
         _Version        =   393216
         ListField       =   "bookpub"
         Text            =   ""
      End
      Begin VB.TextBox txtauthor 
         Height          =   375
         Left            =   840
         TabIndex        =   6
         Top             =   1560
         Width           =   2055
      End
      Begin VB.TextBox txtbookname 
         Height          =   375
         Left            =   960
         TabIndex        =   4
         Top             =   960
         Width           =   2775
      End
      Begin VB.TextBox txtbookid 
         Height          =   405
         Left            =   1320
         TabIndex        =   2
         Top             =   360
         Width           =   2415
      End
      Begin VB.Label Label6 
         Caption         =   "价格"
         Height          =   375
         Left            =   360
         TabIndex        =   11
         Top             =   3480
         Width           =   495
      End
      Begin VB.Label Label5 
         Caption         =   "出版日期"
         Height          =   375
         Left            =   360
         TabIndex        =   9
         Top             =   2880
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "出版社"
         Height          =   255
         Left            =   360
         TabIndex        =   7
         Top             =   2280
         Width           =   615
      End
      Begin VB.Label Label3 
         Caption         =   "作者"
         Height          =   255
         Left            =   360
         TabIndex        =   5
         Top             =   1680
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "书名*"
         Height          =   255
         Left            =   360
         TabIndex        =   3
         Top             =   1080
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "图书编号*"
         Height          =   255
         Left            =   360
         TabIndex        =   1
         Top             =   480
         Width           =   975
      End
   End
End
Attribute VB_Name = "addeditbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public mrc As ADODB.Recordset
Public txtsql, msgtext As String

Private Sub cmdcancel_Click()
  Unload Me
End Sub

Private Sub cmdok_Click()
  If Trim(txtbookid.Text) = "" Or Trim(txtbookname.Text) = "" Then
     MsgBox "加*数据项不能为空!", vbOKOnly + vbExclamation, "信息提示"
     Exit Sub
  End If
  
  If flag = 1 Then
     txtsql = "select * from books where bookid='" & Trim(txtbookid.Text) & "'"
     Set mrc = ExecuteSQL(txtsql, msgtext)
     If mrc.EOF = False Then
        MsgBox "存在相同的图书编号!", vbOKOnly + vbExclamation, "警告"
        txtbookid.SetFocus
        mrc.Close
        Exit Sub
     Else
        mrc.Close
     End If
     inbook.Adodc1.Recordset.AddNew
     inbook.Adodc1.Recordset.Fields("bookid") = Trim(txtbookid.Text)
     inbook.Adodc1.Recordset.Fields("bookname") = Trim(txtbookname.Text)
     inbook.Adodc1.Recordset.Fields("bookauthor") = Trim(txtauthor.Text)
     inbook.Adodc1.Recordset.Fields("bookpub") = Trim(DataCombo1.Text)
     inbook.Adodc1.Recordset.Fields("bookpubdate") = Trim(txtpubdate.Text)
     inbook.Adodc1.Recordset.Fields("bookprice") = Val(Trim(txtprice.Text))
     inbook.Adodc1.Recordset.Fields("borrow") = "n"
     inbook.Adodc1.Recordset.Fields("booked") = "n"
     inbook.Adodc1.Recordset.Update
  Else
     inbook.Adodc1.Recordset.Fields("bookid") = Trim(txtbookid.Text)
     inbook.Adodc1.Recordset.Fields("bookname") = Trim(txtbookname.Text)
     inbook.Adodc1.Recordset.Fields("bookauthor") = Trim(txtauthor.Text)
     inbook.Adodc1.Recordset.Fields("bookpub") = Trim(DataCombo1.Text)
     If Trim(txtpubdate.Text) = "" Then
        inbook.Adodc1.Recordset.Fields("bookpubdate") = "<Null>"
     Else
        inbook.Adodc1.Recordset.Fields("bookpubdate") = CDate(txtpubdate.Text)
     End If
     inbook.Adodc1.Recordset.Fields("bookprice") = Val(Trim(txtprice.Text))
     inbook.Adodc1.Recordset.Update
  End If
     Unload Me
End Sub

Private Sub Form_Load()
  If flag = 2 Then
     txtbookid.Text = inbook.Adodc1.Recordset.Fields("bookid")
     txtbookname.Text = inbook.Adodc1.Recordset.Fields("bookname")
     txtauthor.Text = inbook.Adodc1.Recordset.Fields("bookauthor")
     DataCombo1.Text = inbook.Adodc1.Recordset.Fields("bookpub")
     txtpubdate.Text = inbook.Adodc1.Recordset.Fields("bookpubdate")
     txtprice.Text = inbook.Adodc1.Recordset.Fields("bookprice")
  End If
End Sub

⌨️ 快捷键说明

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