📄 frmbackbookinfo.frm
字号:
VERSION 5.00
Object = "{74848F95-A02A-4286-AF0C-A3C755E4A5B3}#1.0#0"; "actskn43.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmbackbookinfo
Caption = "还书"
ClientHeight = 6870
ClientLeft = 60
ClientTop = 450
ClientWidth = 8250
LinkTopic = "Form1"
ScaleHeight = 6870
ScaleWidth = 8250
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame4
Height = 975
Left = 1320
TabIndex = 9
Top = 5760
Width = 5655
Begin VB.CommandButton Command4
Caption = "取消"
Height = 495
Left = 3240
TabIndex = 11
Top = 240
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "还书"
Height = 495
Left = 840
TabIndex = 10
Top = 240
Width = 1335
End
End
Begin VB.Frame Frame3
Caption = "书籍信息"
Height = 3375
Left = 120
TabIndex = 8
Top = 2280
Width = 7935
Begin MSDataGridLib.DataGrid DataGrid1
Height = 3015
Left = 120
TabIndex = 16
Top = 240
Width = 7695
_ExtentX = 13573
_ExtentY = 5318
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Begin VB.Frame Frame2
Caption = "按书籍信息"
Height = 975
Left = 120
TabIndex = 4
Top = 1200
Width = 7935
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel4
Height = 255
Left = 3120
OleObjectBlob = "frmbackbookinfo.frx":0000
TabIndex = 15
Top = 360
Width = 855
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel3
Height = 255
Left = 120
OleObjectBlob = "frmbackbookinfo.frx":0066
TabIndex = 14
Top = 360
Width = 735
End
Begin VB.ComboBox Combo4
Height = 300
Left = 4080
TabIndex = 7
Text = "选择图书名"
Top = 360
Width = 1815
End
Begin VB.ComboBox Combo3
Height = 300
Left = 960
TabIndex = 6
Text = "选择图书编号"
Top = 360
Width = 1815
End
Begin VB.CommandButton Command2
Caption = "查询"
Height = 375
Left = 6360
TabIndex = 5
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame1
Caption = "按读者信息"
Height = 975
Left = 120
TabIndex = 0
Top = 120
Width = 7935
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel2
Height = 255
Left = 3000
OleObjectBlob = "frmbackbookinfo.frx":00CC
TabIndex = 13
Top = 360
Width = 975
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1
Height = 255
Left = 120
OleObjectBlob = "frmbackbookinfo.frx":0132
TabIndex = 12
Top = 360
Width = 735
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 6360
TabIndex = 3
Top = 360
Width = 1215
End
Begin VB.ComboBox Combo2
Height = 300
Left = 4080
TabIndex = 2
Text = "选择读者姓名"
Top = 360
Width = 1815
End
Begin VB.ComboBox Combo1
Height = 300
Left = 960
TabIndex = 1
Text = "选择读者编号"
Top = 360
Width = 1815
End
End
Begin ACTIVESKINLibCtl.Skin Skin1
Left = 0
OleObjectBlob = "frmbackbookinfo.frx":0198
Top = 0
End
End
Attribute VB_Name = "frmbackbookinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
Combo2.ListIndex = Combo1.ListIndex
End Sub
Private Sub Combo2_Click()
Combo1.ListIndex = Combo2.ListIndex
End Sub
Private Sub Combo3_Click()
Combo4.ListIndex = Combo3.ListIndex
End Sub
Private Sub Combo4_Click()
Combo3.ListIndex = Combo4.ListIndex
End Sub
Private Sub Command1_Click()
Dim rs_reader As New ADODB.Recordset
Dim sql As String
findform = False
sql = "select * from 借阅信息 where 读者姓名 = '" & Combo2.Text & "'"
rs_reader.CursorLocation = adUseClient
rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic
Set DataGrid1.DataSource = rs_reader
DataGrid1.AllowAddNew = False
DataGrid1.AllowUpdate = False
DataGrid1.AllowDelete = False
End Sub
Private Sub Command2_Click()
Dim rs_book As New ADODB.Recordset
Dim sql As String
findform = False
sql = "select * from 借阅信息 where 书籍编号 = '" & Combo3.Text & "'"
rs_book.CursorLocation = adUseClient
rs_book.Open sql, conn, adOpenKeyset, adLockPessimistic
Set DataGrid1.DataSource = rs_book
DataGrid1.AllowAddNew = False
DataGrid1.AllowUpdate = False
DataGrid1.AllowDelete = False
End Sub
Private Sub Command3_Click()
Dim book_number As String
Dim reader_number As String
Dim answer As String
Dim rs_back As New ADODB.Recordset
Dim sql As String
book_number = DataGrid1.Columns(3).CellValue(DataGrid1.Bookmark)
reader_number = DataGrid1.Columns(1).CellValue(DataGrid1.Bookmark)
answer = MsgBox("确定要还这本书吗?", vbYesNo, "")
If answer = vbYes Then
sql = "select * from 借阅信息 where 书籍编号 = '" & book_number & "'" '删除这本书在"借阅信息"中的记录
rs_back.CursorLocation = adUseClient
rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_back.Delete
rs_back.Update
rs_back.Close
sql = "select * from 书籍信息 where 图书编号 = '" & book_number & "'"
rs_back.CursorLocation = adUseClient
rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_back.Fields(7) = "否"
rs_back.Update
rs_back.Close
sql = "select * from 读者信息 where 读者编号 = '" & reader_number & "'"
rs_back.CursorLocation = adUseClient
rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_back.Fields(8) = rs_back.Fields(8) - 1
rs_back.Update
rs_back.Close
MsgBox "成功删除!", vbOKOnly + vbExclamation, ""
DataGrid1.AllowDelete = False
Else
Exit Sub
End If
If findform = True Then
Command1_Click
Else
Command2_Click
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim skn
skn = App.Path & "\Book.skn"
'载入时的一些脚本.
Skin1.LoadSkin skn
Skin1.ApplySkin Me.hWnd ' 应用皮肤到这个窗口和它的子控件中Dim rs_reader As New ADODB.Recordset
Dim rs_book As New ADODB.Recordset
Dim sql As String
sql = "select * from [读者信息]"
rs_reader.CursorLocation = adUseClient
rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic
If Not rs_reader.EOF Then
Do While Not rs_reader.EOF
Combo1.AddItem rs_reader.Fields(1)
Combo2.AddItem rs_reader.Fields(0)
rs_reader.MoveNext
Loop
End If
rs_reader.Close
sql = "select * from [借阅信息]"
rs_book.CursorLocation = adUseClient
rs_book.Open sql, conn, adOpenKeyset, adLockPessimistic
If Not rs_book.EOF Then
Do While Not rs_book.EOF
Combo3.AddItem rs_book.Fields(3)
Combo4.AddItem rs_book.Fields(4)
rs_book.MoveNext
Loop
End If
rs_book.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -