📄 form5.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 420
TabIndex = 12
Top = 2640
Width = 1215
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "图书总数:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 11
Top = 2040
Width = 1335
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "出版日期:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 10
Top = 1440
Width = 1335
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "图书名称:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 9
Top = 840
Width = 1335
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "图书编号:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 8
Top = 240
Width = 1335
End
End
Attribute VB_Name = "form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Call xpbutton1_Click
End Sub
Private Sub Form_Load()
Me.BackColor = RGB(121, 153, 207)
utid
End Sub
Private Sub xpbutton1_Click()
If admin = False Then
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If sts1.State = adStateOpen Then
sts1.Close
End If
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "编号和姓名不可为空,请检查看输入", vbInformation, "输入错误"
Exit Sub
End If
sts1.Open "select * from 图书信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While sts1.EOF = False
If sts1.Fields(0) = Text1.Text Then
Dim str1 As String
str1 = MsgBox("您输入的图书编号己存在,是否将图书数量累加到原始图书上?", vbQuestion + vbYesNo, "编号重复")
If str1 = vbYes Then
sts1.Fields(5) = Int(sts1.Fields(5)) + Int(Text3.Text)
sts1.Fields(6) = Int(sts1.Fields(6)) + Int(Text3.Text)
sts1.Update
MsgBox "添加成功!请验证!", vbInformation, "累加成功"
Exit Sub
Else
Text1.Text = ""
Exit Sub
End If
Else
sts1.MoveNext
End If
Loop
sts1.AddNew
sts1.Fields(0) = Text1.Text '图书编号
sts1.Fields(1) = Text2.Text '图书名称
sts1.Fields(2) = DTPicker1.Value '出版日期
sts1.Fields(3) = Text5.Text '图书简介
sts1.Fields(4) = Text6.Text '图书其它
sts1.Fields(5) = Text3.Text '图书总数
sts1.Fields(6) = Text3.Text '剩余数量
sts1.Update
MsgBox "数据己添加成功", vbInformation, "添加成功"
Text1.Text = ""
End Sub
Private Sub xpbutton2_Click()
If admin = False Then
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If sts1.State = adStateOpen Then
sts1.Close
End If
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "编号和姓名不可为空,请检查看输入", vbInformation, "输入错误"
Exit Sub
End If
sts1.Open "select * from 图书信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While sts1.EOF = False
If sts1.Fields(0) = Text1.Text Then
sts1.Fields(1) = Text2.Text '图书名称
sts1.Fields(2) = DTPicker1.Value '出版日期
sts1.Fields(3) = Text5.Text '图书简介
sts1.Fields(4) = Text6.Text '图书其它
sts1.Fields(5) = Text3.Text '图书总数
sts1.Fields(6) = Text3.Text '剩余数量
sts1.Update
MsgBox "数据己修改成功", vbInformation, "修改成功"
Else
sts1.MoveNext
End If
Loop
End Sub
Private Sub xpbutton4_Click()
If systembooks - bookindex <= 0 Then
MsgBox "您己经超出借书所限本数!", vbInformation, id + "您好!"
Exit Sub
End If
'--------------检测图书剩余
If sts2.State = adStateOpen Then
sts2.Close
End If
sts2.Open "select * from 图书信息 where 图书编号='" & Text1.Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If sts2.Fields(6) <= 0 Then
MsgBox "您所借图书己被其他用户借走,目前剩余为0本", vbInformation, idname + "您好"
Exit Sub
End If
'--------------
If admin = True Then
If sts1.State = adStateOpen Then
sts1.Close
End If
sts1.Open "select * from 借书信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If sts3.State = adStateOpen Then
sts3.Close
End If
sts3.Open "select * from 个人信息 where 学号='" & id & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If sts2.Fields(6) <= 0 Then
MsgBox "您所借图书己被其他用户借走,目前剩余为0本", vbInformation, idname + "您好"
Exit Sub
End If
sts1.AddNew
sts1.Fields(1) = id '学号
sts1.Fields(2) = Text1.Text '图书编号
sts1.Fields(3) = Date '借书日期
sts1.Fields(4) = idname '操作人
Dim sstr1 As String '设定归还期限延长30天
sstr1 = "30"
sts1.Fields(5) = Int(Date + sstr1) '借出最终期限
sts1.Fields(6) = "0"
sts2.Fields(6) = sts2.Fields(6) - 1 '图书数量-1
sts3.Fields(9) = sts3.Fields(9) + 1 '借书数量+1
sts1.Update
sts2.Update
sts3.Update
MsgBox "您的借书记录己成功,请继续操作!", vbInformation, idname + "您好"
Exit Sub
End If
'----------
If sts1.State = adStateOpen Then
sts1.Close
End If
sts1.Open "select * from 借书批准处", cnn, adOpenKeyset, adLockOptimistic, adCmdText
sts1.AddNew
sts1.Fields(1) = id '学号
sts1.Fields(2) = Text1.Text '图书编号
sts1.Fields(3) = Date '借书日期
sts1.Fields(4) = idname '操作人
Dim sstr2 As String '设定归还期限延长30天
sstr2 = "30"
sts1.Fields(5) = Int(Date + sstr2) '借出最终期限
sts1.Fields(6) = "0"
sts1.Fields(7) = "1"
sts1.Update
If sts2.State = adStateOpen Then
sts2.Close
End If
sts2.Open "select * from 用户交流", cnn, adOpenKeyset, adLockOptimistic, adCmdText
sts2.AddNew
sts2.Fields(0) = sts1.Fields(0)
sts2.Fields(1) = id '学号
sts2.Fields(2) = adminid '当前管理员
sts2.Fields(3) = "ID为:" + id + "的用户向管理员请求借出编号为" + Text1.Text + "的图书!"
sts2.Fields(4) = Date
sts2.Fields(5) = "0"
sts2.Update
MsgBox "您的请求己提交,需要管理员来回复您!", vbInformation, idname + "您好"
Exit Sub
End Sub
Private Sub utid()
If ifuser = "0" Then
If sts1.State = adStateOpen Then
sts1.Close
End If
sts1.Open "select * from 图书信息 where 图书编号='" & tkUserID & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Text1.Text = tkUserID '图书编号
Text2.Text = sts1.Fields(1) '图书名称
DTPicker1.Value = sts1.Fields(2) '出版日期
Text5.Text = sts1.Fields(3) '图书简介
Text6.Text = sts1.Fields(4) '图书其它
Text3.Text = sts1.Fields(5) '图书总数
Text4.Text = sts1.Fields(6) '剩余数量
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -