【VB开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VB开源代码-frmbookstyle.frm的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
VERSION 5.00
Begin VB.Form frmaddbookstyle
Caption = "图书类别"
ClientHeight = 3615
ClientLeft = 60
ClientTop = 450
ClientWidth = 4710
LinkTopic = "Form2"
MaxButton = 0 'False
ScaleHeight = 3615
ScaleWidth = 4710
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 2280
TabIndex = 5
Top = 2280
Width = 975
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 720
TabIndex = 4
Top = 2280
Width = 975
End
Begin VB.TextBox Text2
Height = 375
Left = 1440
TabIndex = 3
Top = 1320
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 2
Top = 600
Width = 1815
End
Begin
VB.Label Label2
Caption = "图书编号"
Height = 495
Left = 360
TabIndex = 1
Top = 1320
Width = 1335
End
Begin VB.Label Label1
Caption = "图书类别"
Height = 375
Left = 360
TabIndex = 0
Top = 600
Width = 1335
End
End
Attribute VB_Name = "frmaddbookstyle"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim rs_bookstyle As New ADODB.Recordset
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
sql = "select * from 图书类别 where 类别名称='" & Text1.Text & "'"
rs_bookstyle.Open sql, conn, adOpenKeyset, adLockPessi
mistic
If rs_bookstyle.EOF Then
rs_bookstyle.AddNew
rs_bookstyle.Fields(0) = Trim(Text1.Text)
rs_bookstyle.Fields(1) = Trim(Text2.Text)
rs_bookstyle.Update
MsgBox "添加图书类别成功!", vbOKOnly, ""
rs_bookstyle.Close
Else
MsgBox "读者类别重复!", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Text1.Text = ""
rs_bookstyle.Close
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub