📄 frmborrow.frm
字号:
Left = 8880
TabIndex = 13
Top = 600
Width = 975
End
Begin VB.TextBox txbType
Height = 375
Left = 6840
TabIndex = 11
Top = 600
Width = 975
End
Begin VB.TextBox txbName
Height = 390
Left = 5160
TabIndex = 9
Top = 600
Width = 975
End
Begin VB.TextBox txbReader
Height = 375
Left = 1320
TabIndex = 6
Top = 600
Width = 1695
End
Begin VB.OptionButton rbnReaderCode
Caption = "条形码"
Height = 255
Left = 240
TabIndex = 5
Top = 840
Width = 975
End
Begin VB.OptionButton rbnReaderNumber
Caption = "编号"
Height = 255
Left = 240
TabIndex = 4
Top = 480
Value = -1 'True
Width = 975
End
Begin VB.Label Label4
Caption = "可借册数"
Height = 255
Left = 8040
TabIndex = 12
Top = 720
Width = 735
End
Begin VB.Label Label3
Caption = "类型"
Height = 255
Left = 6360
TabIndex = 10
Top = 720
Width = 735
End
Begin VB.Label Label2
Caption = "姓名"
Height = 255
Left = 4680
TabIndex = 8
Top = 720
Width = 735
End
Begin VB.Label Label1
Caption = "回车确认输入"
Height = 255
Left = 3240
TabIndex = 7
Top = 720
Width = 1335
End
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 630
Left = 0
TabIndex = 0
Top = 0
Width = 10335
_ExtentX = 18230
_ExtentY = 1111
ButtonWidth = 820
ButtonHeight = 953
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 2
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
Key = "btnSave"
ImageIndex = 8
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "btnExit"
ImageIndex = 10
EndProperty
EndProperty
Begin MSComctlLib.ImageList ImageList1
Left = 9240
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 10
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":04DE
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":05F0
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":0702
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":0814
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":0926
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":0A38
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":0B4A
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":0C5C
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":0D6E
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmBorrow.frx":0E80
Key = ""
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "frmBorrow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Dim db As New DataBases
Adodc1.ConnectionString = db.sConn
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If StrComp(Button.Key, "btnExit") = 0 Then
Unload Me
ElseIf StrComp(Button.Key, "btnSave") = 0 Then
Me.txbReader.Enabled = True
Dim db As New DataBases
Dim strSQL As String
strSQL = "select 姓名,编号,a.类型,图书册书 from 读者类型"
strSQL = strSQL + " as a , 读者信息 as b where 编号='Error'"
Set Adodc1.Recordset = db.RunSelectSQL(strSQL)
Label8.Caption = "0"
txbReader.SetFocus
End If
End Sub
Private Sub txbBook_KeyPress(KeyAscii As Integer)
'判断输入的字符是否是回车
If KeyAscii = 13 Then
'判断读者的借阅数量是否超过可借数量
If CInt(Adodc1.Recordset.RecordCount) >= CInt(Trim(txbCount.Text)) Then
MsgBox ("你借阅数量已经超过可借数量")
End If
Dim db As New DataBases
Dim strSQL As String
strSQL = "select 编号,书名,出版社,价格,b.可借天数 from"
strSQL = strSQL + " 图书信息 as a , 图书类型 as b "
strSQL = strSQL + "where a.类型 = b.类型名称"
'判断输入的是编号,还是条形码
If rbnBookNumber.Value = -1 Then
strSQL = strSQL + " and 编号='" + Trim(txbBook.Text) + "'"
Else
strSQL = strSQL + " and 条形码='" + Trim(txbBook.Text) + "'"
End If
Dim rs As Recordset
Set rs = db.RunSelectSQL(strSQL)
Dim strNumber As String
Dim strName As String
Dim strPress As String
Dim strPrice As String
Dim strDays As String
If rs.RecordCount <> 0 Then
'判断该读者是否已经借过这本书
Dim rstmp As Recordset
Set rstmp = Adodc1.Recordset
rstmp.MoveFirst
While (Not rstmp.EOF)
If Trim(rs("编号")) = Trim(rstmp("编号")) Then
MsgBox ("图书已经借给该读者!")
Exit Sub
End If
rstmp.MoveNext
Wend
strNumber = Trim(rs("编号"))
strDays = Trim(rs("可借天数"))
strSQL = " insert into 图书借阅(图书编号,"
strSQL = strSQL + "读者编号,借阅时间,应还时间,"
strSQL = strSQL + "续借次数,操作员,状态) values('"
strSQL = strSQL + strNumber + "','"
strSQL = strSQL + Trim(txbReader.Text)
strSQL = strSQL + "','" + CStr(Date) + "','"
strSQL = strSQL + CStr(Date + CInt(strDays)) + "'"
strSQL = strSQL + ",0,'操作员','新借')"
db.RunSelectSQL (strSQL)
db.RunSelectSQL ("sf_图书借阅")
Label8.Caption = CInt(Label8.Caption) + 1
Adodc1.Recordset.Requery
End If
End If
End Sub
Private Sub txbReader_KeyPress(KeyAscii As Integer)
'判断按下的是不是回车键
If KeyAscii = 13 Then
Dim db As New DataBases
Dim strSQL As String
strSQL = "select 姓名,编号,a.类型,图书册书 from 读者类型"
strSQL = strSQL + " as a , 读者信息 as b where a.类型 = b.类型"
'判断输入的是编号,还是条形码
If rbnReaderNumber.Value = -1 Then
strSQL = strSQL + " and 编号='" + Trim(txbReader.Text) + "'"
Else
strSQL = strSQL + " and 条形码='" + Trim(txbReader.Text) + "'"
End If
Dim rs As Recordset
Set rs = db.RunSelectSQL(strSQL)
'判断是否存在此读者
If rs.RecordCount <> 0 Then
'获得读者信息
txbName.Text = Trim(rs("姓名"))
txbType.Text = Trim(rs("类型"))
txbCount.Text = Trim(rs("图书册书"))
'查看此读者是否已经借阅了其它书
strSQL = "select 状态,编号,书名,借阅时间,应还时间,出版社,"
strSQL = strSQL + "价格 from 图书信息 as a , 图书借阅 as b where"
strSQL = strSQL + " a.编号 = b.图书编号 and 状态 = '未还' and "
strSQL = strSQL + "读者编号 ='" + Trim(rs("编号")) + "'"
Set rs = db.RunSelectSQLUpdatable(strSQL)
If rs.RecordCount <> 0 Then
Set Adodc1.Recordset = rs
End If
txbReader.Enabled = False
txbBook.SetFocus
Else
txbName.Text = ""
txbType.Text = ""
txbCount.Text = ""
txbReader.SetFocus
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -