可视化程序设计图书管理系统 第7页
可视化程序设计图书管理系统 第7页
System.EventArgs) Handles btnLend.Click
Try
Dim readerdr As DataRow = readerds.Tables(0).Rows(0)
If readerdr.Item("未还书数") >= readerdr.Item("可借书数") Then
MsgBox("读者的可借书数已经达到上限")
Else
Dim bookdr As DataRow = bookds.Tables(0).Rows(0)
If bookdr.Item("现存数量") < 1 Then
MsgBox("此书已全部借出")
Else
Dim str As String = "图书编号='" & txtBookId.Text & "'"
Dim dr As DataRow() = borrowds.Tables(0).Select(str)
If dr.GetLength(0) > 1 Then
MsgBox("读者已经借了此书,并且还未还")
Else
Dim borrowdr As DataRow = borrowds.Tables(0).NewRow
borrowdr.Item("图书编号") = txtBookId.Text
borrowdr.Item("书名") = bookdr.Item("书名")
borrowdr.Item("借书者编号") = readerdr.Item("编号")
borrowdr.Item("借书者") = readerdr.Item("姓名")
borrowdr.Item("借书日期") = txtBorrowTime.Text
borrowdr.Item("应还日期") = txtReturnTime.Text
borrowdr.Item("在馆") = "否"
borrowdr.Item("条形码") = bookdr.Item("条形码")
borrowdr.Item("出版社") = bookdr.Item("出版社")
borrowdr.Item("出版时间") = bookdr.Item("出版时间")
borrowdr.Item("类别") = bookdr.Item("类别")
borrowdr.Item("图书价格") = bookdr.Item("图书价格")
borrowds.Tables(0).Rows.Add(borrowdr)
OleConn.Adapter.SelectCommand.CommandText =borrowstr
OleConn.UpDate(borrowds.Tables(0))
borrowds.AcceptChanges()
readerdr.BeginEdit()
readerdr.Item("未还书数") = readerdr.Item("未还书数") + 1
readerdr.Item("借书次数") = readerdr.Item("借书次数") + 1
readerdr.Item("借书日期") = txtBorrowTime.Text
readerdr.EndEdit()
OleConn.Adapter.SelectCommand.CommandText =readerstr
OleConn.UpDate(readerds.Tables(0))
readerds.AcceptChanges()
txtUnReturnedCount.Text = readerdr.Item("未
OleConn.UpDate(bookds.Tables(0))
bookds.AcceptChanges()
txtExistCount.Text = bookdr.Item("现存数量")
btnLend.Enabled = False
MsgBox("借书成功")
End If
End If
End If
Catch ex As Exception
OleConn.DisplayError(ex)
End Try
End Sub
“清空”和“退出”按钮的实现代码如下:
Private Sub btnClear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClear.Click
borrowds.Clear()
txtReaderId.Text = ""
txtReaderName.Text = ""
txtReaderSex.Text = ""
txtReaderTelephone.Text = ""
txtReaderAddress.Text = ""
txtReaderAddTime.Text = ""
txtLendCount.Text = ""
txtCanBorrowCount.Text = ""
txtUnReturnedCount.Text = ""
txtBookId.Text = ""
txtBookName.Text = ""
txtBookType.Text = ""
txtBookAuthor.Text = ""
txtPublisher.Text = ""
txtPublishTime.Text = ""
txtExistCount.Text = ""
txtBorrowTime.Text = ""
btnReturn.Enabled = False
txtReaderId.Focus()
End Sub
Private Sub btnClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Close()
End Sub
3.4 修改密码模块
修改密码模块用来修改用户登录系统的密码,其运行界面如图3.6所示:
上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页