📄 frmreturnbook.frm
字号:
VERSION 5.00
Begin VB.Form frmReturnBook
Caption = "还书"
ClientHeight = 1695
ClientLeft = 60
ClientTop = 345
ClientWidth = 4125
LinkTopic = "Form1"
ScaleHeight = 1695
ScaleWidth = 4125
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command2
Caption = "返回(&C)"
Height = 375
Left = 2280
TabIndex = 4
Top = 1200
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "归还(&Y)"
Height = 375
Left = 600
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VB.Frame Frame1
Height = 855
Left = 120
TabIndex = 0
Top = 120
Width = 3975
Begin VB.TextBox txtBookid
Height = 495
Left = 1680
TabIndex = 2
Top = 240
Width = 2175
End
Begin VB.Label Label1
Caption = "请输入图书编号:"
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 1575
End
End
End
Attribute VB_Name = "frmReturnBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim sql As String
Private Sub cmdOk_Click()
sql = "SELECT * FROM lendBook where bookid='" & txtBookid & "' AND hasreturned=false"
cmd.CommandText = sql
rs.Open cmd, , adOpenDynamic, adLockOptimistic
rs.MoveFirst
rs.Update "hasreturned", True
MsgBox "图书已归还!!"
rs.Close
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'窗体居中显示
Me.Top = (Screen.Height - Me.Height) \ 2
Me.Left = (Screen.Width - Me.Width) \ 2
'使用Connection对象与具体的数据库文件相连接
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db\library.mdb"
'每个Command必须与一个Connection对象连接
Set cmd.ActiveConnection = conn
'设置命令的类型是使用SQL语句
cmd.CommandType = adCmdText
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -