📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form JieShuXiuGai
Caption = "借书信息修改"
ClientHeight = 8010
ClientLeft = 60
ClientTop = 345
ClientWidth = 10050
LinkTopic = "Form2"
ScaleHeight = 8010
ScaleWidth = 10050
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "取消"
Height = 375
Left = 8040
TabIndex = 12
Top = 6240
Width = 975
End
Begin VB.Frame Frame2
Caption = "修改区"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4575
Left = 5160
TabIndex = 1
Top = 720
Width = 3855
Begin VB.CommandButton Command2
Caption = "修改"
Height = 375
Left = 2520
TabIndex = 11
Top = 3600
Width = 975
End
Begin VB.TextBox Text5
Height = 495
Left = 1800
TabIndex = 10
Top = 2640
Width = 1815
End
Begin VB.TextBox Text4
Height = 495
Left = 1800
TabIndex = 8
Top = 1560
Width = 1815
End
Begin VB.TextBox Text3
Height = 495
Left = 1800
TabIndex = 7
Top = 600
Width = 1815
End
Begin VB.Label Label5
Caption = "借书日期"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 9
Top = 2760
Width = 1215
End
Begin VB.Label Label4
Caption = "借书证号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 6
Top = 1680
Width = 1335
End
Begin VB.Label Label3
Caption = "书号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 5
Top = 720
Width = 735
End
End
Begin VB.Frame Frame1
Caption = "请输入书号"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4575
Left = 960
TabIndex = 0
Top = 720
Width = 3855
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 2400
TabIndex = 4
Top = 3600
Width = 975
End
Begin VB.TextBox Text1
Height = 495
Left = 1560
TabIndex = 3
Top = 1680
Width = 1815
End
Begin VB.Label Label1
Caption = "书号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 2
Top = 1800
Width = 735
End
End
End
Attribute VB_Name = "JieShuXiuGai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim flag As Boolean
Public rs_find As adodb.Recordset
Private Sub Command1_Click()
flag = False
Set rs_find = New adodb.Recordset
rs_find.Open "select * from borrowinfo where bookno='" & Text1.Text & "'", conn, adOpenStatic, adLockOptimistic
If rs_find.Fields("bookno") = "" Then
MsgBox "无信息,请重新输入书号"
Call clear
Else
Text3.Text = rs_find.Fields("bookno")
Text4.Text = rs_find.Fields("borrowno")
Text5.Text = rs_find.Fields("borrowdate")
End If
End Sub
Private Sub Command2_Click()
If flag = False Then
Dim bid As New adodb.Recordset
Dim nid As New adodb.Recordset
Dim lid As New adodb.Recordset
bid.Open "select * from books where bookid='" & Text3.Text & "'", conn, adOpenStatic, adLockOptimistic
nid.Open "select * from readers where readerno='" & Text4.Text & "'", conn, adOpenStatic, adLockOptimistic
If rs_find.EOF = False Then
Dim book As New adodb.Recordset
Dim book1 As New adodb.Recordset
book1.Open "select * from books where bookid ='" & rs_find.Fields("bookno") & "'", conn, adOpenStatic, adLockOptimistic
If Text3.Text <> rs_find.Fields("bookno") Then
If bid.EOF = False Then
rs_find.Fields("bookno") = Trim(Text3.Text)
Else
MsgBox "无此书"
Call clear
End If
End If
If Text4.Text <> rs_find.Fields("borrowno") Then
If nid.EOF = False Then
rs_find.Fields("borrowno") = Trim(Text4.Text)
Else
MsgBox "无此读者"
Call clear
End If
End If
If Text5.Text <> rs_find.Fields("borrowdate") Then
rs_find.Fields("borrowdate") = Trim(Text5.Text)
End If
Dim re As New adodb.Recordset
Dim re1 As New adodb.Recordset
re.Open "select * from borrowinfo where bookno ='" & rs_find.Fields("bookno") & "'", conn, adOpenStatic, adLockOptimistic
re1.Open "select * from borrowinfo where bookno='" & Text1.Text & "'", conn, adOpenStatic, adLockOptimistic
If re1.EOF = False And re.EOF = False Then
If re.EOF = False And (re.Fields("borrowno") <> re1.Fields("borrowno") Or re.Fields("borrowdate") <> re1.Fields("borrowdate")) Then
re.Delete (adAffectCurrent)
re.Update
End If
End If
If nid.EOF = False And bid.EOF = False Then
rs_find.Update
book.Open "select * from books where bookid ='" & rs_find.Fields("bookno") & "'", conn, adOpenStatic, adLockOptimistic
If book.EOF = False Then
book.Fields("putup") = Trim("已借出")
book.Update
If book1.EOF = False Then
book1.Fields("putup") = Trim("未借")
book1.Update
End If
MsgBox "修改成功"
Call clear
Dim back As New adodb.Recordset
back.Open "select * from returninfo where bookno='" & Text3.Text & "' ", conn, adOpenStatic, adLockOptimistic
If back.EOF = False Then
back.Fields("returnno") = Text3.Text
back.Delete (adAffectCurrent)
back.Update
End If
Else
MsgBox "请输入书号后查询"
Call clear
End If
End If
Else
MsgBox "请输入书号后查询"
Call clear
End If
Else
MsgBox "请输入书号后查询"
Call clear
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set rs_find = New adodb.Recordset
rs_find.Open "select * from borrowinfo", conn, adOpenStatic, adLockOptimistic
flag = True
End Sub
Private Sub clear()
Text1.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -