在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例一般编程问题 → VB图书馆源码(access数据库)

VB图书馆源码(access数据库)

一般编程问题

下载此实例
  • 开发语言:Others
  • 实例大小:0.12M
  • 下载次数:11
  • 浏览次数:265
  • 发布时间:2018-11-07
  • 实例类别:一般编程问题
  • 发 布 人:pophoney123
  • 文件格式:.rar
  • 所需积分:2
 相关标签: vb 图书

实例介绍

【实例简介】

【实例截图】

from clipboard

【核心代码】


VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomct2.ocx"
Begin VB.Form lentbook 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "正在进行借书操作"
   ClientHeight    =   7410
   ClientLeft      =   1815
   ClientTop       =   2190
   ClientWidth     =   11955
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   7410
   ScaleWidth      =   11955
   Begin VB.Frame Frame3 
      Caption         =   "借阅信息"
      Height          =   3015
      Left            =   120
      TabIndex        =   27
      Top             =   4320
      Width           =   11775
      Begin MSDataGridLib.DataGrid DataGrid1 
         Bindings        =   "lentbook.frx":0000
         Height          =   2535
         Left            =   120
         TabIndex        =   28
         Top             =   360
         Width           =   11535
         _ExtentX        =   20346
         _ExtentY        =   4471
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   8
         BeginProperty Column00 
            DataField       =   "读者编号"
            Caption         =   "读者编号"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "读者姓名"
            Caption         =   "读者姓名"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "书籍编号"
            Caption         =   "书籍编号"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "书籍名称"
            Caption         =   "书籍名称"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "书籍类别"
            Caption         =   "书籍类别"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "书籍页码"
            Caption         =   "书籍页码"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   "出版社"
            Caption         =   "出版社"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column07 
            DataField       =   "借书日期"
            Caption         =   "借书日期"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
            BeginProperty Column02 
            EndProperty
            BeginProperty Column03 
            EndProperty
            BeginProperty Column04 
            EndProperty
            BeginProperty Column05 
            EndProperty
            BeginProperty Column06 
            EndProperty
            BeginProperty Column07 
            EndProperty
         EndProperty
      End
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   375
         Left            =   4680
         Top             =   1440
         Visible         =   0   'False
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   661
         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         =   ""
         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 VB.Label Label14 
         Caption         =   "所借图书:"
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   3360
         TabIndex        =   32
         Top             =   120
         Width           =   975
      End
      Begin VB.Label Label15 
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   4440
         TabIndex        =   31
         Top             =   120
         Width           =   975
      End
      Begin VB.Label Label16 
         Caption         =   "还允许借阅的册数:"
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   7800
         TabIndex        =   30
         Top             =   120
         Width           =   1695
      End
      Begin VB.Label Label17 
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   9600
         TabIndex        =   29
         Top             =   120
         Width           =   975
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "借阅图书信息"
      Height          =   2535
      Left            =   120
      TabIndex        =   8
      Top             =   1680
      Width           =   11775
      Begin VB.TextBox bookidtxt 
         BackColor       =   &H00C0FFFF&
         Height          =   375
         Left            =   1560
         TabIndex        =   17
         Top             =   360
         Width           =   3015
      End
      Begin VB.TextBox bookmctxt 
         Enabled         =   0   'False
         Height          =   375
         Left            =   8400
         TabIndex        =   16
         Top             =   960
         Width           =   3135
      End
      Begin VB.TextBox bookcbtxt 
         Enabled         =   0   'False
         Height          =   375
         Left            =   8400
         TabIndex        =   15
         Top             =   1560
         Width           =   3135
      End
      Begin VB.TextBox bookjgtxt 
         Enabled         =   0   'False
         Height          =   375
         Left            =   1560
         TabIndex        =   14
         Top             =   960
         Width           =   1815
      End
      Begin VB.TextBox booklbtxt 
         Enabled         =   0   'False
         Height          =   375
         Left            =   5040
         TabIndex        =   13
         Top             =   960
         Width           =   1815
      End
      Begin VB.TextBox bookymtxt 
         Enabled         =   0   'False
         Height          =   375
         Left            =   5040
         TabIndex        =   12
         Top             =   1560
         Width           =   1815
      End
      Begin VB.TextBox bookzztxt 
         Enabled         =   0   'False
         Height          =   375
         Left            =   1560
         TabIndex        =   11
         Top             =   1560
         Width           =   1815
      End
      Begin VB.CommandButton Command1 
         Caption         =   "借出当前图书(&L)"
         Enabled         =   0   'False
         Height          =   375
         Left            =   9840
         TabIndex        =   9
         Top             =   2040
         Width           =   1695
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   375
         Left            =   1560
         TabIndex        =   10
         Top             =   2040
         Width           =   3135
         _ExtentX        =   5530
         _ExtentY        =   661
         _Version        =   393216
         Format          =   23724033
         CurrentDate     =   38094
      End
      Begin VB.Label Label4 
         Caption         =   "书籍编号:"
         Height          =   375
         Left            =   600
         TabIndex        =   26
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "<输入编号后按回车>"
         ForeColor       =   &H000000FF&
         Height          =   255
         Left            =   4800
         TabIndex        =   25
         Top             =   480
         Width           =   1935
      End
      Begin VB.Label Label6 
         Caption         =   "书籍名称:"
         Height          =   375
         Left            =   7440
         TabIndex        =   24
         Top             =   1080
         Width           =   1215
      End
      Begin VB.Label Label7 
         Caption         =   "  出版社:"
         Height          =   375
         Left            =   7440
         TabIndex        =   23
         Top             =   1680
         Width           =   1095
      End
      Begin VB.Label Label8 
         Caption         =   "书籍价格:"
         Height          =   375
         Left            =   600
         TabIndex        =   22
         Top             =   1080
         Width           =   975
      End
      Begin VB.Label Label9 
         Caption         =   "书籍类别:"
         Height          =   375
         Left            =   4080
         TabIndex        =   21
         Top             =   1080
         Width           =   975
      End
      Begin VB.Label Label10 
         Caption         =   "书籍页码:"
         Height          =   375
         Left            =   4080
         TabIndex        =   20
         Top             =   1680
         Width           =   1095
      End
      Begin VB.Label Label11 
         Caption         =   "书籍作者:"
         Height          =   375
         Left            =   600
         TabIndex        =   19
         Top             =   1680
         Width           =   975
      End
      Begin VB.Label Label12 
         Caption         =   "借出日期:"
         Height          =   255
         Left            =   600
         TabIndex        =   18
         Top             =   2160
         Width           =   1095
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "读者信息"
      Height          =   1335
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   8775
      Begin VB.TextBox readeridtxt 
         BackColor       =   &H00C0FFFF&
         Height          =   375
         Left            =   1560
         TabIndex        =   3
         Top             =   240
         Width           =   2535
      End
      Begin VB.TextBox readertxt 
         Enabled         =   0   'False
         Height          =   375
         Left            =   1560
         TabIndex        =   2
         Top             =   840
         Width           =   1815
      End
      Begin VB.TextBox readerdwtxt 
         Enabled         =   0   'False
         Height          =   375
         Left            =   5280
         TabIndex        =   1
         Top             =   840
         Width           =   3135
      End
      Begin VB.Label Label1 
         Caption         =   "读者编号:"
         Height          =   255
         Left            =   600
         TabIndex        =   7
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "<输入读者编号按回车>"
         ForeColor       =   &H000000FF&
         Height          =   375
         Left            =   4320
         TabIndex        =   6
         Top             =   360
         Width           =   1935
      End
      Begin VB.Label Label3 
         Caption         =   "读者姓名:"
         Height          =   255
         Left            =   600
         TabIndex        =   5
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label13 
         Caption         =   "所属单位:"
         Height          =   255
         Left            =   4320
         TabIndex        =   4
         Top             =   960
         Width           =   975
      End
   End
End
Attribute VB_Name = "lentbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Download by http://www.codesc.net
Option Explicit

Private Sub Command1_Click()

If Label17.Caption <> "0" Then
    Set g_rs = g_db.OpenRecordset("lentinfo", dbOpenTable)
    With g_rs
         .AddNew
         .Fields("读者编号") = readeridtxt.Text
         .Fields("书籍编号") = bookidtxt.Text
         .Fields("借书日期") = DTPicker1.Value
         .Update
    End With
    Set g_rs = Nothing
    g_strsql = "select * from bookinfo where 书籍编号='" & bookidtxt.Text & "'"
    Set g_rs = g_db.OpenRecordset(g_strsql)
    g_rs.Edit
    g_rs.Fields("是否借出").Value = True
    g_rs.Update
    Set g_rs = Nothing
    
     MsgBox "操作成功,请返回!", vbInformation   vbOKOnly, "信息"
    bookidtxt.Text = ""
    bookidtxt.SetFocus
    bookjgtxt.Text = ""
    booklbtxt.Text = ""
    bookmctxt.Text = ""
    bookzztxt.Text = ""
    bookymtxt.Text = ""
    bookcbtxt.Text = ""
    StrDataGrid
Else
     MsgBox "对不起,你的书已经借满了,不能再借!", vbInformation   vbOKOnly, "信息"
End If
Command1.Enabled = False
End Sub

Private Sub Form_Load()

dbl
DTPicker1.Value = Date
End Sub

Private Sub readeridtxt_keypress(keyascii As Integer)

If keyascii = "13" And readeridtxt.Text <> "" Then
    g_strsql = "select * from readerinfo where 读者编号='" & readeridtxt.Text & "'"
    Set g_rs = g_db.OpenRecordset(g_strsql)
    If Not g_rs.EOF Then
       readertxt.Text = g_rs!读者姓名
       readerdwtxt.Text = g_rs!所属单位
       StrDataGrid
      
    Else
       MsgBox "对不起,没有该读者信息!", vbInformation   vbOKOnly, "提示"
       readeridtxt.Text = ""
       readeridtxt.SetFocus
    End If
    Set g_rs = Nothing
ElseIf keyascii = "13" And readeridtxt.Text = "" Then
    MsgBox "对不起,请输入读者编号!", vbInformation   vbOKOnly, "警告"
    readeridtxt.SetFocus
End If
End Sub

Private Sub bookidtxt_keypress(keyascii As Integer)
If keyascii = "13" And readertxt.Text <> "" And bookidtxt.Text <> "" Then
    g_strsql = "select bookInfo.书籍名称,bookInfo.书籍价格,bookInfo.出版社,bookinfo.作者姓名,bookInfo.书籍页码," _
               & " bookInfo.是否借出,bookType.书籍类别 " _
               & " from bookInfo,bookType " _
               & " where 书籍编号='" & bookidtxt.Text & "' and bookInfo.类别代码=bookType.类别代码"
               
    Set g_rs = g_db.OpenRecordset(g_strsql)
       If Not g_rs.EOF Then
            bookjgtxt.Text = g_rs!书籍价格
            booklbtxt.Text = g_rs!书籍类别
            bookmctxt.Text = g_rs!书籍名称
            bookzztxt.Text = g_rs!作者姓名
            bookymtxt.Text = g_rs!书籍页码
            bookcbtxt.Text = g_rs!出版社
            If g_rs!是否借出 = True Then
               MsgBox "对不起,该书已经借出!", vbInformation   vbOKOnly, "信息"
               Command1.Enabled = False
               Set g_rs = Nothing
               Exit Sub
            Else
               Command1.Enabled = True
            End If
       Else
            MsgBox "对不起,馆内没有该书信息!", vbInformation   vbOKOnly, "提示"
            bookidtxt.Text = ""
            bookidtxt.SetFocus
            bookjgtxt.Text = ""
            booklbtxt.Text = ""
            bookmctxt.Text = ""
            bookzztxt.Text = ""
            bookymtxt.Text = ""
            bookcbtxt.Text = ""
        End If
    Set g_rs = Nothing
ElseIf keyascii = "13" And readertxt.Text = "" Then
    MsgBox "请先输入读者编号!", vbInformation   vbOKOnly, "提示"
    readeridtxt.SetFocus
    Exit Sub
ElseIf keyascii = "13" And readertxt.Text <> "" And bookidtxt.Text = "" Then
    MsgBox "请先输入书籍编号!", vbInformation   vbOKOnly, "提示"
    bookidtxt.SetFocus
    Exit Sub
End If
               
End Sub
 
Public Sub StrDataGrid()
Dim StrSQL As String
Dim strcount As Integer
 StrSQL = "select bookinfo.书籍名称,readerinfo.读者姓名,booktype.书籍类别,lentinfo.书籍编号, " _
                & " bookinfo.出版社,bookinfo.书籍页码,lentinfo.读者编号,lentinfo.借书日期,lentinfo.还书日期," _
                & " lentinfo.超出天数,lentinfo.罚款金额" _
                & " from bookinfo,readerinfo,booktype,lentinfo" _
                & " where readerinfo.读者编号=lentinfo.读者编号 and bookinfo.书籍编号=lentinfo.书籍编号 and " _
                & " lentinfo.读者编号='" & readeridtxt.Text & "' and bookinfo.类别代码=booktype.类别代码 and " _
                & " lentinfo.还书日期 is null"
       
        Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" _
                                  & App.Path & "\db2.mdb;Mode=ReadWrite;persist security info=true;Jet OLEDB:Database Password=xgg2213"
        Adodc1.CursorLocation = adUseClient
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = StrSQL
        Adodc1.Refresh
        DataGrid1.Refresh
        Label15.Caption = CStr(Adodc1.Recordset.RecordCount)
        g_strsql = "select * from setinfo"
        Set g_rs = g_db.OpenRecordset(g_strsql)
        strcount = g_rs!借出册数 - Adodc1.Recordset.RecordCount
        Label17.Caption = CStr(strcount)
        bookidtxt.SetFocus
       
End Sub


标签: vb 图书

实例下载地址

VB图书馆源码(access数据库)

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警