📄 lentbook.frm
字号:
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 = 48889857
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
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -