【VB开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VB开源代码-frmaddreaderstyle.frm的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
VERSION 5.00
Begin VB.Form frmaddreaderstyle
Caption = "添加读者类别"
ClientHeight = 4590
ClientLeft = 60
ClientTop = 450
ClientWidth = 6120
LinkTopic = "Form2"
MaxButton = 0 'False
ScaleHeight = 4590
ScaleWidth = 6120
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取消"
Height = 615
Left = 3240
TabIndex = 9
Top = 3600
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 615
Left = 960
TabIndex = 8
Top = 3600
Width = 1215
End
Begin VB.TextBox Text4
Height = 495
Left = 2160
TabIndex = 7
Top = 2520
Width = 1575
End
Begin VB.TextBox Text3
Height = 495
Left = 2160
TabIndex = 6
Top = 1800
Width = 1575
End
Begin VB.TextBox Text2
Height = 495
Left = 2160
TabIndex = 5
Top = 1080
Width = 1575
End
Begin VB.TextBox Text1
Height = 495
Left = 2160
TabIndex = 4
Top = 360
Width = 1575
End
Begin
VB.Label Label4
AutoSize = -1 'True
Caption = "有限期限"
Height = 180
Left = 960
TabIndex = 3
Top = 2640
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "借书期限"
Height = 180
Left = 960
TabIndex = 2
Top = 1920
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "借书数量"
Height = 180
Left = 960
TabIndex = 1
Top = 1200
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "读者种类"
Height = 180
Left = 960
TabIndex = 0
Top = 600
Width = 720
End
End
Attribute VB_Name = "frmaddreaderstyle"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs_readerstyle As New ADODB.Recordset
Private Sub Command1_Click()
Dim sql As String
If Trim(Text1.Text) = "" Then
MsgBox "读者种类不能为空", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "借书数量不能为空", vbOKOnly + vbExclamation, ""
Text2.SetFocus
Exit Sub
End If
If Trim(Text3.Text) = "" Then
MsgBox "借书期限不能为空", vbOKOnly + vbExclamation, ""
Text3.SetFocus
Exit Sub
End If
If Trim(Text4.Text) = "" Then
MsgBox "有限期限不能为空", vbOKOnly + vbExclamation, ""
Text4.SetFocus
Exit Sub
End If
sql = "select * from 读者类别 where 种类名称='" & Text1.Text & "'"
rs_readerstyle.Open sql, conn, adOpenKeyset, adLockPessi
mistic
If rs_readerstyle.EOF Then
rs_readerstyle.AddNew
rs_readerstyle.Fields(0) = Trim(Text1.Text)
rs_readerstyle.Fields(1) = CInt(Text2.Text)
rs_readerstyle.Fields(2) = CInt(Text3.Text)
rs_readerstyle.Fields(3) = CInt(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