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

📄 edbook1.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 edbook1 
   Caption         =   "编辑图书记录"
   ClientHeight    =   7545
   ClientLeft      =   60
   ClientTop       =   420
   ClientWidth     =   10110
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7545
   ScaleWidth      =   10110
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Comm2 
      Caption         =   "取    消"
      Height          =   375
      Left            =   5880
      TabIndex        =   18
      Top             =   7080
      Width           =   975
   End
   Begin VB.CommandButton Comm1 
      Caption         =   "确    定"
      Height          =   375
      Left            =   3840
      TabIndex        =   17
      Top             =   7080
      Width           =   975
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   7920
      Top             =   480
      Visible         =   0   'False
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=libary"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "libary"
      OtherAttributes =   ""
      UserName        =   "sa"
      Password        =   "HZbp0802"
      RecordSource    =   "press"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Index           =   5
      Left            =   3840
      TabIndex        =   6
      Top             =   5280
      Width           =   3615
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Index           =   4
      Left            =   3840
      TabIndex        =   5
      Top             =   4560
      Width           =   3615
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Index           =   3
      Left            =   3840
      TabIndex        =   4
      Top             =   3240
      Width           =   6255
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Index           =   2
      Left            =   3840
      TabIndex        =   3
      Top             =   2760
      Width           =   6255
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Index           =   1
      Left            =   3840
      TabIndex        =   2
      Top             =   2280
      Width           =   6255
   End
   Begin VB.Frame Frame1 
      Caption         =   "图书记录*"
      Height          =   5415
      Left            =   1200
      TabIndex        =   0
      Top             =   840
      Width           =   9375
      Begin VB.CommandButton selcom 
         Caption         =   "……"
         Height          =   375
         Left            =   6480
         TabIndex        =   8
         Top             =   2880
         Width           =   615
      End
      Begin MSDataListLib.DataCombo DataCombo1 
         Bindings        =   "edbook1.frx":0000
         Height          =   330
         Left            =   2640
         TabIndex        =   7
         Top             =   2880
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   582
         _Version        =   393216
         Text            =   ""
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Index           =   0
         Left            =   2640
         TabIndex        =   1
         Top             =   840
         Width           =   6255
      End
      Begin VB.Label Label8 
         Caption         =   "<日期格式:YY-MM-DD>"
         Height          =   375
         Left            =   6360
         TabIndex        =   16
         Top             =   4560
         Width           =   2655
      End
      Begin VB.Label Label7 
         Caption         =   "入库日期*"
         Height          =   375
         Left            =   1440
         TabIndex        =   15
         Top             =   4440
         Width           =   1215
      End
      Begin VB.Label Label6 
         Caption         =   "定    价"
         Height          =   495
         Left            =   1440
         TabIndex        =   14
         Top             =   3720
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "出 版 社"
         Height          =   375
         Left            =   1440
         TabIndex        =   13
         Top             =   3000
         Width           =   1215
      End
      Begin VB.Label Label4 
         Caption         =   "作    者*"
         Height          =   375
         Left            =   1440
         TabIndex        =   12
         Top             =   2400
         Width           =   1335
      End
      Begin VB.Label Label3 
         Caption         =   "书    名*"
         Height          =   375
         Left            =   1440
         TabIndex        =   11
         Top             =   1920
         Width           =   1335
      End
      Begin VB.Label Label2 
         Caption         =   "分 类 号"
         Height          =   375
         Left            =   1440
         TabIndex        =   10
         Top             =   1440
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "图书编号*"
         Height          =   375
         Left            =   1440
         TabIndex        =   9
         Top             =   960
         Width           =   1575
      End
   End
End
Attribute VB_Name = "edbook1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset

Private Sub Comm1_Click()
    If Trim(Text1(0).Text) = "" Or Trim(Text1(2).Text) = "" _
        Or Trim(Text1(3).Text) = "" Or Trim(Text1(5).Text) = "" Then
        MsgBox "加*的地方不能为空,请重新填写!", vbOKOnly, "信息提示"
        Exit Sub
    End If
    If flag = 1 Then
        sqltxt = "select * from book where 图书编号='" + Trim(Text1(0).Text) _
                + "'"
        Set rs = exesql(sqltxt)
        If rs.RecordCount <> 0 Then
            MsgBox "存在相同的图书编号!", vbOKOnly, "信息提示"
            Text1(0).SetFocus
            rs.Close
            Exit Sub
        Else
            rs.Close
        End If
        edbook.Adodc1.Recordset.AddNew
        edbook.Adodc1.Recordset.Fields("图书编号") = Trim(Text1(0).Text)
        edbook.Adodc1.Recordset.Fields("分类号") = Trim(Text1(1).Text)
        edbook.Adodc1.Recordset.Fields("书名") = Trim(Text1(2).Text)
        edbook.Adodc1.Recordset.Fields("作者") = Trim(Text1(3).Text)
        edbook.Adodc1.Recordset.Fields("出版社") = Trim(DataCombo1.Text)
        edbook.Adodc1.Recordset.Fields("定价") = Val(Trim(Text1(4).Text))
        edbook.Adodc1.Recordset.Fields("入库日期") = Format(Trim(Text1(5).Text), _
            "YY-MM-DD")
        edbook.Adodc1.Recordset.Fields("借否") = "否"
        edbook.Adodc1.Recordset.Update
        recs = recs + 1
    Else
        edbook.Adodc1.Recordset.Fields("图书编号") = Trim(Text1(0).Text)
        edbook.Adodc1.Recordset.Fields("分类号") = Trim(Text1(1).Text)
        edbook.Adodc1.Recordset.Fields("书名") = Trim(Text1(2).Text)
        edbook.Adodc1.Recordset.Fields("作者") = Trim(Text1(3).Text)
        edbook.Adodc1.Recordset.Fields("出版社") = Trim(DataCombo1.Text)
        edbook.Adodc1.Recordset.Fields("定价") = Val(Trim(Text1(4).Text))
        edbook.Adodc1.Recordset.Fields("入库日期") = _
                Format(Trim(Text1(5).Text), "YY-MM-DD")
    End If
    Unload Me
End Sub

Private Sub DataCombo1_Click(Area As Integer)

End Sub

Private Sub DataCombo1_KeyPress(KeyAscii As Integer)
    Call endata(KeyAscii)
End Sub


Private Sub Form_Load()
    If flag = 2 Then
        Text1(0).Text = edbook.Adodc1.Recordset.Fields("图书编号") & ""
        Text1(1).Text = edbook.Adodc1.Recordset.Fields("分类号") & ""
        Text1(2).Text = edbook.Adodc1.Recordset.Fields("书名") & ""
        Text1(3).Text = edbook.Adodc1.Recordset.Fields("作者") & ""
        DataCombo1.Text = edbook.Adodc1.Recordset.Fields("出版社") & ""
        Text1(4).Text = edbook.Adodc1.Recordset.Fields("定价") & ""
        Text1(5).Text = edbook.Adodc1.Recordset.Fields("入库日期") & ""
        Text1(0).Enabled = False
    Else
        Text1(5).Text = Date
    End If
End Sub

Private Sub form_activate()
    Adodc1.Refresh
End Sub


Private Sub selcom_Click()
    tna = "press"
    cap = "出版社"
    edrec.Show vbModal
End Sub


Private Sub Text1_Change(Index As Integer)

End Sub


Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
    Call endata(KeyAscii)
End Sub


⌨️ 快捷键说明

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