图书借阅管理系统课程设计报告 第4页

图书借阅管理系统课程设计报告 第4页
Private Sub Command1_Click()
n = MsgBox("确认借出此书!", 64 + 1, "提示")
If n = vbOK Then
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书馆"
Adodc1.RecordSource = "select * from 借书卡表 where 卡号='" & Text1.Text & "'"
Adodc1.Refresh
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "输入不完整!", 64, "提示"
Else
   If Adodc1.Recordset.EOF Then
    MsgBox "无此卡号!", 48, "警告"
   Else
      If Adodc1.Recordset.Fields("借书数目") = 5 Then
        MsgBox "此卡以达最大借书数目,不能再借书!", 48, "警告"
      Else
        With Adodc1.Recordset
        .Fields("书籍编号") = Text2.Text
        .Fields("借书数目") = .Fields("借书数目") + 1
        .Update
        End With
       
       Adodc1.RecordSource = "select * from 图书信息 where  编号='" & Text2.Text & "'"
       Adodc1.Refresh
         If Adodc1.Recordset.EOF Then
            MsgBox "无此图书编号!", 48, 警告
         Else
            If Adodc1.Recordset.Fields("是否借出") = "是" Then
            MsgBox "此书已借出!!!", 16, "错误"
Else
            With Adodc1.Recordset
            .Fields("是否借出") = "是"
            .Update
            End With
           
            Adodc1.RecordSource = "select * from 借还信息 "
            Adodc1.Refresh
            With Adodc1.Recordset
            .AddNew
            .Fields("卡号") = Text1.Text
            .Fields("编号") = Text2.Text
            .Fields("借书日期") = Text3.Text
            .Update
            End With
            End If
          End If
        End If
    End If
  End If
End If
End Sub
  
Private Sub Command2_Click()
 Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书馆"
 Adodc1.RecordSource = "select * from 借还信息 where 卡号='" & Text1.Text & "' and  编号='" & Text2.Text & "'"
 Adodc1.Refresh
If Text1.Text = "" Or Text2.Text = "" Or Text4.Text = "" Then
    MsgBox "输入不完整!", 64, "提示"
Else
   If Adodc1.Recordset.EOF Then
   MsgBox "此卡没有借此书!", 16, "错误"
   Else
    With Adodc1.Recordset
    .Delete
    .Update
    End With
  
    Adodc1.RecordSource = "select * from 图书信息 where 编号='" & Text2.Text & "'"
    Adodc1.Refresh
    With Adodc1.Recordset
   .Fields("是否借出") = "否"
   .Update
    End With
   
    Adodc1.RecordSource = "select * from 借书卡表 where 卡号='" & Text1.Text & "'"
    Adodc1.Refresh
    With Adodc1.Recordset
    .Fields("借书数目") = .Fields("借书数目") - 1
    .Fields("书籍编号") = "空"
    .Update
    End With
   
    a = Format(Text3, "yy,mm,dd")
    b = Format(Text4, "yy,mm,dd")
    c = Month(b) - Month(a)
    d = Day(b) - Day(a)
    e = 30 * c + d - 30
      If e > 0 Then
       MsgBox "此书已超期!", 48, "警告"
       With Adodc1.Recordset
       .Fields("超期天数") = e
       .Fields("费用") = .Fields("费用") - 0.5 * e
       .Update
       End With
       End If
   MsgBox "此书已还回!", 64, "提示"
   End If
End If
End Sub

Private Sub Command3_Click()
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书馆"
Adodc1.RecordSource = "select * from 借还信息 where 卡号='" & Text1.Text & "'and  编号='" & Text2.Text & "'"
Adodc1.Refresh
Set Text3.DataSource = Adodc1
Text3.DataField = "借书日期"
 End Sub

Private Sub Command4_Click()
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书馆"
Adodc1.RecordSource = "select * from 借书卡表 where 卡号='" & Text1.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
MsgBox "无此借书卡!", 48, "警告"
Else
MsgBox "此借书卡费用为" & Trim(Adodc1.Recordset.Fields("费用")) & "元!", 64, "费用查询"
End If
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "denglu"
login.Show
Unload Me
Case "chayue"
mes_search.Show
Unload Me
Case "jieyue"
login.Show
Unload Me
Case "guanli"
login.Show
Unload Me
Case "jieshuka"
login.Show
Unload Me
Case "exit"
Unload Me
Case "help"
aboutus.Show
aboutsubject.Show
End Select
End Sub报表生成系统界面:

上一页  [1] [2] [3] [4] [5] [6] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有