📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form 读者类别管理
Caption = "读者类别管理"
ClientHeight = 3915
ClientLeft = 60
ClientTop = 450
ClientWidth = 6450
LinkTopic = "Form1"
ScaleHeight = 3915
ScaleWidth = 6450
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取消"
Height = 615
Left = 3600
TabIndex = 9
Top = 2520
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 615
Left = 1440
TabIndex = 8
Top = 2520
Width = 1215
End
Begin VB.TextBox Text4
BackColor = &H00E0E0E0&
Height = 495
Left = 4320
TabIndex = 7
Top = 1440
Width = 1335
End
Begin VB.TextBox Text3
BackColor = &H00E0E0E0&
Height = 495
Left = 1320
TabIndex = 6
Top = 1440
Width = 1215
End
Begin VB.TextBox Text2
BackColor = &H00E0E0E0&
Height = 495
Left = 4320
TabIndex = 5
Top = 360
Width = 1335
End
Begin VB.TextBox Text1
BackColor = &H00E0E0E0&
Height = 495
Left = 1320
TabIndex = 4
Top = 360
Width = 1215
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "有限期限(年)"
Height = 375
Left = 3000
TabIndex = 3
Top = 1560
Width = 1095
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "借书期限(天)"
Height = 375
Left = 120
TabIndex = 2
Top = 1560
Width = 1095
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "借书数量(本)"
Height = 375
Left = 2880
TabIndex = 1
Top = 480
Width = 1095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "读者种类"
Height = 375
Left = 240
TabIndex = 0
Top = 480
Width = 855
End
End
Attribute VB_Name = "读者类别管理"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim conn As New ADODB.Connection
Dim rs_readerstyle As New ADODB.Recordset
If Trim(Text1.Text) = "" Then
MsgBox "读者种类不能为空 ", vbOK0nly + vbExclamation, ""
Text1.SetFocus
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "借书数量不能为空", vbOK0nly + vbExclamation, ""
Text2.SetFocus
Exit Sub
End If
If Trim(Text3.Text) = "" Then
MsgBox "借书期限不能为空", vbOK0nly + vbExclamation, ""
Text3.SetFocus
Exit Sub
End If
If Trim(Text4.Text) = "" Then
MsgBox "有限期限不能为空", vbOK0nly + vbExclamation, ""
Text4.SetFocus
Exit Sub
End If
'Provider = "Microsoft.Jet.OLEDB.3.5.1 ;Persist Security Info=false;data source=D:\图书管理系统\database.mdb"
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database.mdb"
sql = "select * from 读者类别 where 种类名称='" & Text1.Text & "'"
rs_readerstyle.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_readerstyle.EOF Then
rs_readerstyle.AddNew
rs_readerstyle.Fields(0) = Trim(Text1.Text)
rs_readerstyle.Fields(1) = Trim(Text2.Text)
rs_readerstyle.Fields(2) = Trim(Text3.Text)
rs_readerstyle.Fields(3) = Trim(Text4.Text)
rs_readerstyle.Update
MsgBox "添加读者类别成功!", vbOKOnly, ""
rs_readerstyle.Close
Else
MsgBox "读者类别重复!", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Text1.Text = ""
rs_readerstyle.Close
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Label7_Click()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -