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

📄 frmstu.frm

📁 第一次用VB编写的图书管理系统,仅供大家参考,呵呵,不足之处多多包含
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmStu 
   Caption         =   "学生借书资料"
   ClientHeight    =   3705
   ClientLeft      =   60
   ClientTop       =   360
   ClientWidth     =   8865
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   3705
   ScaleWidth      =   8865
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtInfo 
      BackColor       =   &H8000000F&
      BorderStyle     =   0  'None
      ForeColor       =   &H00FF0000&
      Height          =   1335
      Left            =   4920
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      TabIndex        =   11
      TabStop         =   0   'False
      Top             =   2040
      Width           =   3375
   End
   Begin VB.CommandButton CmdR 
      Caption         =   "返 回"
      Height          =   375
      Left            =   3120
      TabIndex        =   10
      Top             =   3000
      Width           =   1335
   End
   Begin VB.TextBox txtpwd 
      ForeColor       =   &H000000FF&
      Height          =   270
      IMEMode         =   3  'DISABLE
      Index           =   2
      Left            =   960
      PasswordChar    =   "*"
      TabIndex        =   6
      Top             =   3080
      Width           =   1815
   End
   Begin VB.TextBox txtpwd 
      ForeColor       =   &H000000FF&
      Height          =   270
      IMEMode         =   3  'DISABLE
      Index           =   1
      Left            =   960
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   2600
      Width           =   1815
   End
   Begin VB.TextBox txtpwd 
      ForeColor       =   &H00FF0000&
      Height          =   270
      IMEMode         =   3  'DISABLE
      Index           =   0
      Left            =   960
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   2120
      Width           =   1815
   End
   Begin VB.CommandButton CmdCon 
      Caption         =   "续 借"
      Height          =   375
      Left            =   3120
      TabIndex        =   3
      Top             =   2520
      Width           =   1335
   End
   Begin VB.CommandButton cmdM 
      Caption         =   "修改密码"
      Enabled         =   0   'False
      Height          =   375
      Left            =   3120
      TabIndex        =   2
      Top             =   2040
      Width           =   1335
   End
   Begin MSFlexGridLib.MSFlexGrid Flx 
      Height          =   1815
      Left            =   0
      TabIndex        =   1
      Top             =   120
      Width           =   8775
      _ExtentX        =   15478
      _ExtentY        =   3201
      _Version        =   393216
      Cols            =   7
      FocusRect       =   2
      ScrollBars      =   2
      AllowUserResizing=   1
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   7680
      Top             =   4440
   End
   Begin MSComctlLib.StatusBar StB 
      Align           =   2  'Align Bottom
      Height          =   255
      Left            =   0
      TabIndex        =   0
      Top             =   3450
      Width           =   8865
      _ExtentX        =   15637
      _ExtentY        =   450
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Object.Width           =   4340
            MinWidth        =   3705
            Text            =   "欢迎使用在线借书系统"
            TextSave        =   "欢迎使用在线借书系统"
            Object.ToolTipText     =   "欢迎使用在线借书系统"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Object.Width           =   3175
            Text            =   "操作员:student"
            TextSave        =   "操作员:student"
            Object.ToolTipText     =   "操作员"
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Object.Width           =   3175
            Object.ToolTipText     =   "特殊信息提示"
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   1
            Enabled         =   0   'False
            Object.Width           =   1080
            MinWidth        =   1080
            TextSave        =   "CAPS"
            Object.ToolTipText     =   "大小写"
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Object.Width           =   3175
            Text            =   "##:##:##"
            TextSave        =   "##:##:##"
            Object.ToolTipText     =   "系统时间"
         EndProperty
      EndProperty
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "确认密码"
      Height          =   180
      Left            =   120
      TabIndex        =   9
      Top             =   3120
      Width           =   720
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "新密码"
      Height          =   180
      Left            =   240
      TabIndex        =   8
      Top             =   2640
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "原密码"
      Height          =   180
      Left            =   240
      TabIndex        =   7
      Top             =   2160
      Width           =   540
   End
End
Attribute VB_Name = "frmStu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Readerid As String
Private Sub borrowInfo()
On Error Resume Next
Dim intIndex As Integer
 intIndex = 1
 Do Until (DBRct.EOF)
    flx.AddItem Empty
    flx.Row = flx.Rows - 1
    flx.Col = 0
    flx.Text = intIndex
    flx.CellAlignment = 4
    flx.Col = 1
    flx.Text = DBRct.Fields("bookid").Value
    flx.CellAlignment = 4
    flx.Col = 2
    flx.Text = DBRct.Fields("bookname").Value
    flx.CellAlignment = 4
    flx.Col = 3
    flx.Text = DBRct.Fields("author").Value
    flx.CellAlignment = 4
    flx.Col = 4
    flx.Text = "¥ " & Format(DBRct.Fields("Price").Value, "##0.00")
    flx.CellAlignment = 4
    flx.Col = 5
    If DBRct.Fields("day").Value >= 0 Then
    flx.Text = DBRct.Fields("day").Value & "天"
    Else: flx.Text = "超期 " & -DBRct.Fields("day") & "天"
    End If
    flx.CellAlignment = 4
    flx.Col = 6
    flx.Text = DBRct.Fields("reborrow").Value
    flx.CellAlignment = 4
   DBRct.MoveNext
   intIndex = intIndex + 1
 Loop
End Sub
Private Sub loadFlx()
 Dim intIndex As Long
 flx.MergeCells = flexMergeFree
 flx.Row = 0
 flx.ColWidth(0) = 600
 For intIndex = 1 To flx.Cols - 1
  flx.Col = intIndex
  flx.Text = "已 经 借 的 书"
    flx.CellAlignment = 4
  flx.ColWidth(intIndex) = 1350
  flx.CellBackColor = &HC0FFFF
 Next
 flx.MergeRow(0) = True
 flx.Row = 1
 flx.Col = 0
 flx.Text = "序 号"
 flx.CellAlignment = 4
 flx.CellBackColor = RGB(255, 255, 255)
 flx.Col = 1
 flx.Text = "图书编码"
 flx.CellAlignment = 4
 flx.CellBackColor = RGB(255, 255, 255)
 flx.Col = 2
 flx.Text = "图书名字"
 flx.CellAlignment = 4
 flx.CellBackColor = RGB(255, 255, 255)
 flx.Col = 3
 flx.Text = "图书作者"
 flx.CellAlignment = 4
 flx.CellBackColor = RGB(255, 255, 255)
 flx.Col = 4
 flx.Text = "图书价格"
 flx.CellAlignment = 4
 flx.CellBackColor = RGB(255, 255, 255)
 flx.Col = 5
 flx.Text = "借的天数"
 flx.CellAlignment = 4
 flx.CellBackColor = RGB(255, 255, 255)
 flx.Col = 6
 flx.Text = "是否已经续借"
 flx.CellAlignment = 4
 flx.CellBackColor = RGB(255, 255, 255)
End Sub

Private Sub CmdCon_Click()
 If flx.Row < 2 Then Exit Sub
 flx.Col = 6
 If flx.Text = "是" Then MsgBox "该书已经续借,不能再续借!", vbInformation, "不能续借": Exit Sub
 flx.Col = 5
 If InStr(flx.Text, "超") Then MsgBox "该书已超期不能续借!", vbInformation, "不能续借": Exit Sub
 flx.Col = 2
 If MsgBox("你要续借" & flx.Text & "吗?", vbInformation + vbYesNo, "续借确认") <> vbYes Then Exit Sub
 flx.Col = 1
 ExecuteSQL ("update borrow set borrowdate=getdate(),reborrow='是' where bookid='" & flx.Text & "' and readerid='" & Readerid & "' and returndate is null")
 MsgBox "续借成功!", vbInformation, "成功"
 Do Until flx.Rows = 2
 flx.RemoveItem (flx.Rows - 1)
 Loop
 Call Form_Load
End Sub

Private Sub CmdM_Click()
Call QueryInfo("select pwd from readers where readerid='" & Readerid & "'")
If DBRct.Fields("pwd") = Choose(txtpwd(0)) Then
 If txtpwd(1) = txtpwd(2) Then
 Call ExecuteSQL("update readers set pwd='" & Choose(txtpwd(1)) & "' where readerid='" & Readerid & "'")
 MsgBox " 修改密码成功!", vbInformation, "修改密码"
 Else:
 MsgBox "确认密码和新密码不同!", vbInformation, "修改错误"
 txtpwd(1) = Empty: txtpwd(2) = Empty: txtpwd(1).SetFocus
 End If
Else: MsgBox "密码输入有误!", vbInformation, "密码出错": txtpwd(0) = "": txtpwd(0).SetFocus
End If
End Sub

Private Sub cmdR_Click()
Unload Me: Load FrmMain: FrmMain.Show
End Sub
Private Sub Flx_DblClick()
Call CmdCon_Click
End Sub

Private Sub Form_Load()
On Error Resume Next
StB.Panels(1).Text = "欢迎使用在线借书系统"
StB.Panels(2).Text = "操作员:" & DBRct.Fields("readername").Value
txtInfo = "基 本 信 息" & vbCrLf & "学号:" & DBRct.Fields("readerid") & vbTab & "姓名:" & DBRct.Fields("readername") & vbCrLf & _
          "性别:" & DBRct.Fields("sex") & vbCrLf & "系别:" & DBRct.Fields("gread") & vbTab & "班级:" & DBRct.Fields("class") & vbCrLf & _
          "罚款:" & Format(DBRct.Fields("publish"), "##0.00") & vbCrLf & "住址:" & DBRct.Fields("address")
Readerid = DBRct.Fields("readerid").Value
 Call QueryInfo("select books.bookid,bookname,author,price,reborrow,[day]=case" & _
      " when (reborrow='否' and datediff(day,borrowdate,getdate())<=30 )" & _
      "     or (reborrow='是' and datediff(day,borrowdate,getdate())<=15 ) " & _
      "   then datediff(day,borrowdate,getdate()) " & _
      " when reborrow='否'and datediff(day,borrowdate,getdate())>30" & _
      " then 30-datediff(day,borrowdate,getdate())" & _
      " else 15-datediff(day,borrowdate,getdate()) End " & _
      " from books join borrow on books.bookid=borrow.bookid " & _
      " where readerid='" & Readerid & "' and returndate is null")
 
 DBRct.MoveFirst
 Call loadFlx
 Call borrowInfo
End Sub
Private Sub Form_Resize()
If Me.Height <= 0 Or Me.Width <= 0 Then Exit Sub
Me.Height = 4110
Me.Width = 8970
End Sub

Private Sub Timer1_Timer()
StB.Panels(5).Text = Now
End Sub

Private Sub txtpwd_Change(Index As Integer)
If txtpwd(0) <> Empty And txtpwd(1) <> Empty And txtpwd(2) <> Empty Then CmdM.Enabled = True Else CmdM.Enabled = False
End Sub

⌨️ 快捷键说明

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