📄 form5.frm
字号:
VERSION 5.00
Begin VB.Form Form5
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
BorderStyle = 0 'None
Caption = "还书管理"
ClientHeight = 4035
ClientLeft = 4920
ClientTop = 3450
ClientWidth = 5760
LinkTopic = "Form5"
ScaleHeight = 269
ScaleMode = 3 'Pixel
ScaleWidth = 384
ShowInTaskbar = 0 'False
Begin Project1.xp_canvas xp_canvas1
Height = 3975
Left = 0
TabIndex = 0
Top = 0
Width = 5745
_extentx = 10134
_extenty = 7011
caption = "还书管理"
icon = "Form5.frx":0000
Begin VB.Frame Frame1
Height = 2295
Left = 360
TabIndex = 3
Top = 840
Width = 4815
Begin VB.TextBox Text2
Height = 495
Left = 1440
TabIndex = 5
Top = 960
Width = 2175
End
Begin VB.TextBox Text1
Height = 495
Left = 1440
TabIndex = 4
Top = 240
Width = 2175
End
Begin VB.Label Label4
Caption = "未还书总数"
Height = 375
Left = 120
TabIndex = 9
Top = 1680
Width = 1095
End
Begin VB.Label Label2
Caption = "图书编号"
Height = 375
Left = 120
TabIndex = 8
Top = 1020
Width = 1095
End
Begin VB.Label Label1
Caption = " 工 号"
Height = 375
Left = 120
TabIndex = 7
Top = 300
Width = 1095
End
Begin VB.Label Label3
Height = 375
Left = 1680
TabIndex = 6
Top = 1680
Width = 1095
End
End
Begin Project1.xpcmdbutton Command2
Height = 495
Left = 3000
TabIndex = 2
Top = 3240
Width = 1695
_extentx = 2990
_extenty = 873
caption = "退 出"
font = "Form5.frx":57F4
End
Begin Project1.xpcmdbutton Command1
Height = 495
Left = 840
TabIndex = 1
Top = 3240
Width = 1695
_extentx = 2990
_extenty = 873
caption = "还 书"
font = "Form5.frx":5820
End
Begin Project1.xptopbuttons xptopbuttons2
Height = 315
Left = 4920
Top = 120
Width = 315
_extentx = 556
_extenty = 556
value = 2
End
Begin Project1.xptopbuttons xptopbuttons1
Height = 315
Left = 5280
Top = 120
Width = 315
_extentx = 556
_extenty = 556
End
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*******************************************
' “ 还书管理窗体“
' 此窗体主要功能:图书归还功能即消除借阅的图书信息
'
'
'作者:朱宏梅
'制作日期: 2004-5-30
'********************************************
Option Explicit
Private Sub Command1_Click()
Dim sql1, sql2 As String
Dim num As Integer
'检测用户名及书号正确否
sql1 = "select * from worker where [工号]=?"
sql2 = "select * from book where [图书编码]=?"
Dim param1, param2, param3 As ADODB.Parameter
Dim cmd1, cmd2, cmd3 As ADODB.Command
Set cmd1 = New ADODB.Command
Set cmd2 = New ADODB.Command
Set cmd3 = New ADODB.Command
Set param1 = New ADODB.Parameter
Set param2 = New ADODB.Parameter
Set param3 = New ADODB.Parameter
With param1
.Direction = adParamInput
.Type = adBSTR
.Size = 8
.Value = Text1.Text
End With
cmd1.Parameters.Append param1
cmd1.CommandText = sql1
cmd1.CommandType = adCmdText
Set cmd1.ActiveConnection = con
Set rst = cmd1.Execute
If rst.RecordCount <= 0 Then
frmMsg.Show
frmMsg.notice.Visible = True
frmMsg.Text1.Text = "没有此工号!"
Exit Sub
End If
With param2
.Direction = adParamInput
.Type = adBSTR
.Size = 8
.Value = Text2.Text
End With
cmd2.Parameters.Append param2
cmd2.CommandText = sql2
cmd2.CommandType = adCmdText
Set cmd2.ActiveConnection = con
Set rst1 = cmd2.Execute
If rst1.RecordCount <= 0 Then
frmMsg.Show
frmMsg.notice.Visible = True
frmMsg.Text1.Text = "没有此图书编号!"
Exit Sub
End If
sql1 = "select * from record where [工号]=?"
With param3
.Direction = adParamInput
.Type = adBSTR
.Size = 8
.Value = Text1.Text
End With
cmd3.Parameters.Append param1
cmd3.CommandText = sql1
cmd3.CommandType = adCmdText
Set cmd3.ActiveConnection = con
Set rst = cmd3.Execute
If rst.RecordCount = 0 Then
num = 0
Label3.Caption = str(num)
frmMsg.Show
frmMsg.notice.Visible = True
frmMsg.Text1.Text = "您没有借阅此图书!"
Exit Sub
Else
num = rst.RecordCount - 1
sql1 = "select * from record where [图书编码]='" & Trim(Text2.Text) & "'" & "and [工号]='" & Trim(Text1.Text) & "'"
Set rst1 = New ADODB.Recordset
rst1.Open sql1, con, adOpenDynamic, adLockOptimistic
If rst1.RecordCount <= 0 Then
frmMsg.Show
frmMsg.notice.Visible = True
frmMsg.Text1.Text = "您没有借阅此图书!"
Exit Sub
End If
sql1 = "delete from record where [图书编码]='" & Trim(Text2.Text) & "'"
Set rst = New ADODB.Recordset
rst.Open sql1, con, adOpenDynamic, adLockOptimistic
frmMsg.Show
frmMsg.notice.Visible = True
frmMsg.Text1.Text = "还书成功!"
Label3.Caption = str(num)
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim sql1, sql2 As String
sql1 = "select * from book"
sql2 = "select * from worker"
Set rst = New ADODB.Recordset
Set rst1 = New ADODB.Recordset
Call connect_db
rst.Open sql2, con, adOpenDynamic, adLockOptimistic
rst1.Open sql1, con, adOpenDynamic, adLockOptimistic
End Sub
Private Sub xptopbuttons1_Click()
Unload Me
End Sub
Private Sub xptopbuttons2_Click()
Me.WindowState = 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -