📄 frmbookreturn.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Frmbookreturn
Caption = "Form1"
ClientHeight = 3720
ClientLeft = 60
ClientTop = 465
ClientWidth = 6210
LinkTopic = "Form1"
ScaleHeight = 3720
ScaleWidth = 6210
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1920
Top = 2880
Visible = 0 'False
Width = 2175
_ExtentX = 3836
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = $"Frmbookreturn.frx":0000
OLEDBString = $"Frmbookreturn.frx":008C
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from Borrow_book"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Frmbookreturn.frx":0118
Height = 1815
Left = 480
TabIndex = 3
Top = 720
Width = 4935
_ExtentX = 8705
_ExtentY = 3201
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
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 = 3
BeginProperty Column00
DataField = "borrow_id"
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 = "borrow_name"
Caption = "图书名称"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "borrow_type"
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
BeginProperty Column02
EndProperty
EndProperty
End
Begin VB.CommandButton Command2
Caption = "返 回"
Height = 495
Left = 4440
TabIndex = 1
Top = 2880
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "我要还"
Height = 495
Left = 240
TabIndex = 0
Top = 2880
Width = 1215
End
Begin VB.Label Label1
Caption = "你已借了以下几本书:"
Height = 255
Left = 480
TabIndex = 2
Top = 240
Width = 1815
End
End
Attribute VB_Name = "Frmbookreturn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Yn As String
Dim Return_date As Integer
Dim Yborrow As Boolean
Dim book_id, book_name, book_type As String
Private Sub Command1_Click()
'Adodc1.Refresh
'DataGrid1.Refresh
Open_borrow_book
Do While cnn.EOF = False
If cnn.EOF = True Then
Exit Do
End If
If cnn.Fields(3).Value = DataGrid1.Text Then
Yn = DataGrid1.Text
DataGrid1.Col = 0
book_id = DataGrid1.Text
DataGrid1.Col = 1
book_name = DataGrid1.Text
DataGrid1.Col = 2
book_type = DataGrid1.Text
DataGrid1.Col = 0
Return_date = cnn.Fields(8).Value
cnn.Delete
cnn.Update
Adodc1.Refresh
DataGrid1.Refresh
Ynborrow
Adodc1.Refresh
DataGrid1.Refresh
Exit Do
End If
cnn.MoveNext
Loop
Borrow_no = Borrow_no - 1
Open_Student_message
Do While cnn.EOF = False
If cnn.EOF = True Then
Exit Sub
End If
If cnn.Fields(0).Value = student_ic Then
cnn.Fields(5).Value = Borrow_no
'MsgBox Borrow_no
End If
cnn.MoveNext
Loop
return_money
book_money
If DataGrid1.Row = -1 Then
Command1.Enabled = False
Exit Sub
Else
Command1.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
set_window
'Adodc1.RecordSource = "select * from Borrow_book where " & & "=" & "'" & student_ic & "'"
Adodc1.RecordSource = "select * from Borrow_book where student_ic=" & "'" & student_ic & "'"
Adodc1.Refresh
If DataGrid1.Row = -1 Then
Command1.Enabled = False
Exit Sub
Else
Command1.Enabled = True
End If
Adodc1.Refresh
DataGrid1.Refresh
End Sub
Public Sub Open_borrow_book1()
Set cnn2 = New ADODB.Recordset
cn = "select * from Borrow_book"
cnn2.Open cn, st, adOpenKeyset, adLockOptimistic, adcmtext
End Sub
Public Sub Ynborrow()
Yborrow = False
Open_book_message
Do While cnn.EOF = False
If cnn.EOF = True Then
Exit Do
End If
Open_borrow_book1
Do While cnn2.EOF = False
If cnn2.EOF = True Then
Exit Do
End If
If Trim(cnn.Fields(0).Value) = Trim(cnn2.Fields(3).Value) Then
'cnn.Fields(9).Value = "已借"
Yborrow = True
End If
cnn2.MoveNext
Loop
If Yborrow = True Then
cnn.Fields(9).Value = "已借"
Else
cnn.Fields(9).Value = "可借"
End If
Yborrow = False
cnn.MoveNext
Loop
End Sub
Public Sub return_money()
Open_Student_message
Do While cnn.EOF = False
If cnn.EOF = True Then
Exit Do
End If
If cnn.Fields(0).Value = student_ic And Val(Return_date) < 0 Then
'If Val(Return_date) > 0 Then
cnn.Fields(6).Value = cnn.Fields(6).Value + (-Return_date) * window_money
MsgBox "你这本书已经欠费啦!"
MsgBox window_money
'Exit Do
' End If
End If
cnn.MoveNext
Loop
End Sub
Public Sub book_money()
If Return_date < 0 Then
Open_book_money
cnn.AddNew
cnn.Fields(0).Value = student_ic
cnn.Fields(1).Value = book_id
cnn.Fields(2).Value = book_name
cnn.Fields(3).Value = book_type
cnn.Fields(4).Value = -Return_date
cnn.Fields(5).Value = -Return_date * window_money
cnn.Update
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -