图书借阅管理系统课程设计报告 第5页
代码:Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim d As Integer
If Not IsNumeric(Text1) Then
MsgBox "输入为空或输入格式不正确!", 64, "提示"
Else
If Val(Text1.Text) < 1 Or Val(Text2.Text) > 12 Then
MsgBox "请输入1-12的数字!", 64, "提示"
Else
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书馆"
Adodc1.RecordSource = "select 借书数目,费用 from 借书卡表"
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
a = a + Adodc1.Recordset.Fields("借书数目")
b = b + Adodc1.Recordset.Fields("费用")
b = -b
Adodc1.Recordset.MoveNext
End If
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "输入不完整!", 64, "提示"
Else
Adodc1.RecordSource = "select * from 图书信息"
Adodc1.Refresh
Do While Not Adodc1.Recordset.EOF
c = Format(Adodc1.Recordset.Fields("进货日期"), "yyyy,mm,dd")
If Val(Mid(c, 1, 4)) = Val(Mid(Label4.Caption, 1, 4)) And Mid(c, 6, 2) >= Val(Text1.Text) And Mid(c, 6, 2) <= Val(Text2.Text) Then
d = d + 1
End If
Adodc1.Recordset.MoveNext
Loop
Adodc1.RecordSource = "select * from 基本信息"
Adodc1.Refresh
With Adodc1.Recordset
.AddNew
.Fields("借出册数") = a
.Fields("罚款") = b
.Fields("新增册数") = d
.Fields("起始月份") = Text1
.Fields("截止月份") = Text2
.Update
End With
DataReport1.Show
End If
End If
End If
End Sub
login.Show
Unload Me
Case "exit"
Unload Me
Case "help"
aboutus.Show
aboutsubject.Show
End Select
End Sub
报表界面:借阅系统界面:
代码:
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
上一页 [1] [2] [3] [4] [5] [6] 下一页