📄 form6.frm
字号:
VERSION 5.00
Begin VB.Form Form6
Caption = "Form6"
ClientHeight = 5910
ClientLeft = 60
ClientTop = 450
ClientWidth = 11865
LinkTopic = "Form6"
MDIChild = -1 'True
ScaleHeight = 5910
ScaleWidth = 11865
Begin VB.CommandButton Command4
Caption = "删除"
Height = 375
Left = 5160
TabIndex = 24
Top = 4920
Width = 1575
End
Begin VB.CommandButton Command3
Caption = "更新"
Height = 375
Left = 2760
TabIndex = 22
Top = 4920
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 240
TabIndex = 20
Top = 4920
Width = 1575
End
Begin VB.Frame Frame1
Caption = "图书资料"
Height = 4575
Left = 120
TabIndex = 0
Top = 120
Width = 9255
Begin VB.TextBox Text4
Height = 270
Left = 1440
TabIndex = 25
Top = 960
Width = 2055
End
Begin VB.CommandButton Command2
Caption = "信息"
Height = 255
Left = 3720
TabIndex = 21
Top = 360
Width = 615
End
Begin VB.TextBox TxtDingJia
BeginProperty DataFormat
Type = 1
Format = "0.00"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
Height = 270
Left = 1440
TabIndex = 9
Top = 3960
Width = 1215
End
Begin VB.TextBox Text2
Height = 270
Left = 1440
TabIndex = 8
Top = 1560
Width = 2535
End
Begin VB.TextBox Text5
Height = 270
Left = 1440
TabIndex = 7
Top = 2160
Width = 2535
End
Begin VB.TextBox Text3
Height = 270
Left = 1440
TabIndex = 6
Top = 2760
Width = 2535
End
Begin VB.TextBox TxtChuBanRQ
Height = 270
Left = 1440
TabIndex = 5
Top = 3360
Width = 1935
End
Begin VB.TextBox Text6
Height = 270
Left = 5880
TabIndex = 4
Top = 360
Width = 975
End
Begin VB.TextBox Text7
Height = 270
Left = 5880
TabIndex = 3
Top = 960
Width = 975
End
Begin VB.TextBox TxtJianJie
Height = 2535
Left = 5880
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 2
Top = 1680
Width = 3255
End
Begin VB.TextBox Text1
Height = 270
Left = 1440
TabIndex = 1
Top = 360
Width = 2055
End
Begin VB.Label Label12
Height = 255
Left = 7080
TabIndex = 26
Top = 360
Width = 615
End
Begin VB.Label Label1
Caption = "格式:1986-04-07"
Height = 255
Left = 3480
TabIndex = 23
Top = 3480
Width = 2055
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "定价:"
Height = 180
Left = 720
TabIndex = 19
Top = 4080
Width = 540
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "图书编号:"
Height = 180
Left = 360
TabIndex = 18
Top = 480
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "所属类别:"
Height = 180
Left = 360
TabIndex = 17
Top = 1080
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "图书名称:"
Height = 180
Left = 360
TabIndex = 16
Top = 1680
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "出版社:"
Height = 180
Left = 480
TabIndex = 15
Top = 2280
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "作者:"
Height = 180
Left = 720
TabIndex = 14
Top = 2880
Width = 540
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "出版日期:"
Height = 180
Left = 360
TabIndex = 13
Top = 3480
Width = 900
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "数量:"
Height = 180
Left = 5280
TabIndex = 12
Top = 480
Width = 540
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "状态:"
Height = 180
Left = 5280
TabIndex = 11
Top = 1080
Width = 540
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "内容简介:"
Height = 180
Left = 4920
TabIndex = 10
Top = 1680
Width = 900
End
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub ComboFuLei_Change()
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入书籍编号", vbOKOnly, "提示": Exit Sub
End If
If Text2.Text = "" Then
MsgBox "请输入书名", vbOKOnly, "提示": Exit Sub
End If
If Text3.Text = "" Then
MsgBox "请输入作者", vbOKOnly, "提示": Exit Sub
End If
If Text4.Text = "" Then
MsgBox "请输入类别", vbOKOnly, "提示": Exit Sub
End If
If Text6.Text = "" Then
MsgBox "请输入数量", vbOKOnly, "提示": Exit Sub
End If
If Text7.Text = "" Then
MsgBox "请输入状态", vbOKOnly, "提示": Exit Sub
End If
If TxtDingJia.Text = "" Then
MsgBox "请输入价格", vbOKOnly, "提示": Exit Sub
End If
With rsbook
If .State = adStateOpen Then .Close
.Open "select * from 书籍 where 编号='" + Text1.Text + "'", cn, adOpenKeyset, adLockOptimistic, 1
If .RecordCount > 0 Then
MsgBox "此图书编号已存在!", vbOKOnly, "提示"
Else
.AddNew
.Fields("编号") = Text1.Text
.Fields("类别") = Text4.Text
.Fields("名称") = Text2.Text
.Fields("出版社") = Text5.Text
.Fields("作者") = Text3.Text
.Fields("出版日期") = Int(Val(TxtChuBanRQ.Text))
.Fields("定价") = Val(TxtDingJia.Text)
.Fields("定价") = TxtDingJia.Text
.Fields("数量") = Text6.Text
.Fields("状态") = Text7.Text
.Fields("简介") = TxtJianJie.Text
.Update
MsgBox "添加成功!", vbOKOnly, "提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text5.Text = ""
Text6.Text = ""
TxtChuBanRQ.Text = ""
End If
End With
End Sub
Private Sub Command3_Click()
If rsbook.State = adStateOpen Then rsbook.Close
If Text1.Text <> "" Then
rsbook.Open "select * from 书籍 where 书籍编号='" + Text1.Text + "'", cn, adOpenKeyset, adLockOptimistic
rsbook.Fields("书籍编号") = Text1.Text
Else: Exit Sub
End If
If Text4.Text <> "" Then
rsbook.Fields("类别") = Text4.Text
Else: MsgBox "请输入类别", vbOKOnly, "提示"
Exit Sub
End If
If Text2.Text <> "" Then
rsbook.Fields("名称") = Text2.Text
Else: MsgBox "请输入名称", vbOKOnly, "提示"
Exit Sub
End If
If TxtDingJia.Text <> "" Then
rsbook.Fields("定价") = Int(Val(TxtDingJia.Text))
Else: MsgBox "请输入类定价", vbOKOnly, "提示"
Exit Sub
End If
If Text6.Text <> "" Then
rsbook.Fields("数量") = Val(Text6.Text)
Else: MsgBox "请输入数量", vbOKOnly, "提示"
Exit Sub
End If
If Text7.Text <> "" Then
rsbook.Fields("状态") = Val(Text7.Text)
Else: MsgBox "请输入状态", vbOKOnly, "提示"
Exit Sub
End If
rsbook.Fields("出版社") = Text5.Text
rsbook.Fields("作者") = Text3.Text
rsbook.Fields("出版日期") = TxtChuBanRQ.Text
rsbook.Fields("简介") = TxtJianJie.Text
rsbook.Update
MsgBox "操作成功!", vbOKOnly, "提示"
End Sub
Private Sub Command4_Click()
Dim bid As String
bid = "编号='" + Text1 + "'"
If rslend.State = adStateOpen Then rslend.Close
rslend.Open "select * from 书籍 where 已借书籍='" + MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 0) + "'", cn, adOpenKeyset, adLockOptimistic, 1
If rslend.RecordCount > 0 Then
If MsgBox("此图书尚末归还,确认要删除吗", vbInformation + vbYesNo, "图书删除") = vbNo Then Exit Sub
End If
If MsgBox("确认真的要删除该图书吗", vbCritical + vbYesNo, "删除") = vbYes Then
cn.Execute "delete from 书籍 where " + bid
MsgBox "删除成功", vbOKOnly, "提示"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -