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

📄 jieyuedengji.dob

📁 VB的图书馆管理系统
💻 DOB
📖 第 1 页 / 共 3 页
字号:
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   120
      Top             =   8040
      Visible         =   0   'False
      Width           =   1980
      _ExtentX        =   3493
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      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 MSAdodcLib.Adodc Adodc2 
      Height          =   330
      Left            =   2160
      Top             =   8040
      Visible         =   0   'False
      Width           =   1980
      _ExtentX        =   3493
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc2"
      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 MSAdodcLib.Adodc Adodc3 
      Height          =   330
      Left            =   4200
      Top             =   8040
      Visible         =   0   'False
      Width           =   1980
      _ExtentX        =   3493
      _ExtentY        =   582
      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=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc3"
      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
End
Attribute VB_Name = "JieYueDengJi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Dim adoRS职员 As ADODB.Recordset
Dim db As Connection
Dim strSQL As String

Private Sub cmdAdd_Click()
    On Error GoTo AddErr
    
    Adodc1.Recordset.AddNew
    Adodc1.Recordset.Fields("职员id").Value = txt职员id.Text
    If SSTab1.Tab = 0 Then
        Adodc1.Recordset.Fields("图书id").Value = Adodc2.Recordset.Fields("图书id").Value
        If opt语言(0).Value Then
            Adodc1.Recordset.Fields("语言").Value = "中"
        Else
            Adodc1.Recordset.Fields("语言").Value = "外"
        End If
    End If
    Adodc1.Recordset.Update
      
    Exit Sub
AddErr:
    MsgBox Err.Description
End Sub

Private Sub cmdDelete_Click()
  On Error GoTo DeleteErr
  
    Dim nYN As Byte
    
     nYN = MsgBox("您正准备删除当前记录。" & Chr(13) & Chr(13) & _
        "假如您单击“是”,您将不能撤消这个删除操作。" & Chr(13) & _
        "您确认删除这条记录吗?", vbExclamation + vbYesNo)
    
    If nYN = vbYes Then
      With Adodc1.Recordset
            If .EOF And .BOF Then Exit Sub
            .Delete
            .MoveNext
            
            If .RecordCount > 0 And .EOF Then
                .MoveLast
                ElseIf .RecordCount = 0 Then .MovePrevious
            End If
      End With
    End If

  Exit Sub
DeleteErr:
  MsgBox Err.Description

End Sub

Private Sub cmdFilter_Click()
    Dim strFilter As String
    '生成filter字符串
    strFilter = ""
    If Trim(txt图书id.Text) <> "" Then
        strFilter = "图书ID=" & Trim(txt图书id.Text)
    End If
    If Trim(txt作者.Text) <> "" Then
        If strFilter = "" Then
            strFilter = "作者 like '%" & Trim(txt作者.Text) & "%'"
        Else
            strFilter = strFilter & " and 作者 like '%" & Trim(txt作者.Text) & "%'"
        End If
    End If
    If txt书名.Text <> "" Then
        If strFilter = "" Then
            strFilter = "书名 like '%" & txt书名.Text & "%'"
        Else
            strFilter = strFilter & " and 书名 like '%" & txt书名.Text & "%'"
        End If
    End If
    If DataCombo2.Text <> "" Then
        If strFilter = "" Then
            strFilter = "分类id=" & DataCombo2.BoundText
        Else
            strFilter = strFilter & " and 分类id=" & DataCombo2.BoundText
        End If
    End If
    If opt语言(0).Value Then
        If strFilter = "" Then
            Adodc2.RecordSource = "select 图书ID, 分类ID, 书名, 作者, 出版单位, 单价, 册数, 出版日期, 登记日期, 备注, 页数 from 中文图书"
        Else
            Adodc2.RecordSource = "select 图书ID, 分类ID, 书名, 作者, 出版单位, 单价, 册数, 出版日期, 登记日期, 备注, 页数 from 中文图书 where " & strFilter
        End If
    Else
        If strFilter = "" Then
            Adodc2.RecordSource = "select 图书ID, 分类ID, 书名, 译名, 文种ID, 作者, 出版单位, 单价, 册数, 出版日期, 登记日期, 备注, 页数 from 外文图书"
        Else
            Adodc2.RecordSource = "select 图书ID, 分类ID, 书名, 译名, 文种ID, 作者, 出版单位, 单价, 册数, 出版日期, 登记日期, 备注, 页数 from 外文图书 where " & strFilter
        End If
    End If
    Adodc2.Refresh
    If Adodc2.Recordset.RecordCount = 0 Then
        setButtons False
    Else
        If Trim(txt职员id.Text) = "" Then
            setButtons False
        Else
            setButtons True
        End If
    End If
End Sub

Private Sub cmdFind_Click()
    
    strSQL = "select a.职员id, a.电话, b.部门名称 from 职员 a, 部门 b where a.部门ID=b.部门ID and 姓名 = '" & txt姓名.Text & "'"
    Set adoRS职员 = db.Execute(strSQL)
    
    If Not (adoRS职员.EOF Or adoRS职员.BOF) Then
        txt职员id.Text = adoRS职员.Fields("职员id").Value
        txt部门.Text = IIf(IsNull(adoRS职员.Fields("部门名称").Value), "", adoRS职员.Fields("部门名称").Value)
        txt电话.Text = IIf(IsNull(adoRS职员.Fields("电话").Value), "", adoRS职员.Fields("电话").Value)
    Else
        txt职员id.Text = ""
        txt部门.Text = ""
        txt电话.Text = ""
        MsgBox "不存在该职员,请检查所输入的姓名。如果添加职员,请与系统管理员联系。", vbExclamation
    End If
End Sub

Private Sub cmdRefresh_Click()
  '只有多用户应用程序需要
  On Error GoTo RefreshErr
  Adodc1.Refresh
  Exit Sub
RefreshErr:
  MsgBox Err.Description

End Sub

Private Sub cmdUpdate_Click()
  On Error GoTo UpdateErr

  Adodc1.Recordset.UpdateBatch adAffectAll
  Exit Sub
UpdateErr:
  MsgBox Err.Description

End Sub

Private Sub cmdFindQK_Click()
    Dim strFilter As String
    '生成filter字符串
    strFilter = ""
    If Trim(txtQKMC.Text) <> "" Then
        strFilter = "名称 like '%" & Trim(txtQKMC.Text) & "%'"
    End If
    If Trim(txtQKYM.Text) <> "" Then
        If strFilter = "" Then
            strFilter = "译名 like '%" & Trim(txtQKYM.Text) & "%'"
        Else
            strFilter = strFilter & " and 译名 like '%" & Trim(txtQKYM.Text) & "%'"
        End If
    End If
    If txtQKND.Text <> "" Then
        If strFilter = "" Then
            strFilter = "年度=" & txtQKND.Text
        Else
            strFilter = strFilter & " and 年度=" & txtQKND.Text
        End If
    End If
    If txtQKQH.Text <> "" Then
        If strFilter = "" Then
            strFilter = "期号=" & txtQKQH.Text
        Else
            strFilter = strFilter & " and 期号=" & txtQKQH.Text
        End If
    End If
    If strFilter = "" Then
        Adodc4.RecordSource = "SELECT 期刊登记ID, 名称, 译名, 年度, 期号, 刊期, 库存册数, 借阅册数, 在库册数 FROM 期刊在库册数 Order by 名称, 年度, 期号"
    Else
        Adodc4.RecordSource = "SELECT 期刊登记ID, 名称, 译名, 年度, 期号, 刊期, 库存册数, 借阅册数, 在库册数 FROM 期刊在库册数 where " & strFilter & " Order by 名称, 年度, 期号"
    End If
    Adodc4.Refresh
    If Adodc4.Recordset.RecordCount = 0 Then
        setButtons False
    Else
        If Trim(txt职员id.Text) = "" Then
            setButtons False
        Else
            setButtons True
        End If
    End If
End Sub

Private Sub SSTab1_Click(PreviousTab As Integer)
    If SSTab1.Tab = 0 Then
        If Adodc2.Recordset.RecordCount = 0 Then
            setButtons False
        Else
            If Trim(txt职员id.Text) = "" Then
                setButtons False
            Else
                setButtons True
            End If
        End If
    Else
        If Adodc4.Recordset.RecordCount = 0 Then
            setButtons False
        Else
            If Trim(txt职员id.Text) = "" Then
                setButtons False
            Else
                setButtons True
            End If
        End If
    End If
End Sub

Private Sub txt职员id_Change()
    Dim sID As String
    sID = txt职员id.Text
    
    If sID = "" Then
        With Adodc1
            .RecordSource = "select 借阅ID,语言,职员ID,图书ID,借阅日期,归还日期 from 图书借阅 WHERE 职员ID = -1 Order by 借阅ID;"
            .Refresh
        End With
        setButtons False
    Else
        With Adodc1
            .RecordSource = "select 借阅ID,语言,职员ID,图书ID,借阅日期,归还日期 from 图书借阅 WHERE 职员ID = " & sID & " Order by 借阅ID;"
            .Refresh
        End With
        If SSTab1.Tab = 0 Then
            If Adodc2.Recordset.RecordCount = 0 Then
                setButtons False
            Else
                setButtons True
            End If
        Else
            If Adodc4.Recordset.RecordCount = 0 Then
                setButtons False
            Else
                setButtons True
            End If
        End If
    End If
End Sub

Private Sub UserDocument_Initialize()
    With Adodc1
        .ConnectionString = pConn
        .RecordSource = "select 借阅ID,语言,职员ID,图书ID,借阅日期,归还日期 from 图书借阅 Order by 借阅ID"
        .Refresh
    End With
    
    With Adodc2
        .ConnectionString = pConn
        .RecordSource = "select 图书ID, 分类ID, 书名, 作者, 出版单位, 单价, 册数, 出版日期, 登记日期, 备注, 页数 from 中文图书 where 图书ID=-1"
        .Refresh
    End With
    
    With Adodc3
        .ConnectionString = pConn
        .RecordSource = "图书分类"
        .Refresh
    End With
    
    With Adodc4
        .ConnectionString = pConn
        .RecordSource = "SELECT 期刊登记ID, 名称, 译名, 年度, 期号, 刊期, 库存册数, 借阅册数, 在库册数 FROM 期刊在库册数 where 期刊登记ID=-1 Order by 名称, 年度, 期号"
        .Refresh
    End With
    
    Set db = New Connection
    db.CursorLocation = adUseClient
    db.Open pConn
End Sub

Private Sub setButtons(blnEnable As Boolean)
    cmdAdd.Enabled = blnEnable
    cmdUpdate.Enabled = blnEnable
    cmdDelete.Enabled = blnEnable
    cmdRefresh.Enabled = blnEnable
End Sub

⌨️ 快捷键说明

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