📄 frmaddbookinfo.frm
字号:
VERSION 5.00
Object = "{74848F95-A02A-4286-AF0C-A3C755E4A5B3}#1.0#0"; "actskn43.ocx"
Begin VB.Form frmaddbookinfo
Caption = "添加图书信息"
ClientHeight = 5010
ClientLeft = 60
ClientTop = 450
ClientWidth = 7980
LinkTopic = "Form1"
ScaleHeight = 5010
ScaleWidth = 7980
StartUpPosition = 2 '屏幕中心
Begin ACTIVESKINLibCtl.Skin Skin1
Left = 360
OleObjectBlob = "frmaddbookinfo.frx":0000
Top = 4440
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 4560
TabIndex = 9
Top = 4080
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 1440
TabIndex = 8
Top = 4080
Width = 1455
End
Begin VB.TextBox Text4
Height = 390
Left = 1560
TabIndex = 6
Top = 3000
Width = 1815
End
Begin VB.TextBox Text6
Height = 390
Left = 5520
TabIndex = 5
Top = 2280
Width = 1815
End
Begin VB.TextBox Text3
Height = 390
Left = 1560
TabIndex = 4
Top = 2280
Width = 1815
End
Begin VB.TextBox Text5
Height = 390
Left = 5520
TabIndex = 3
Top = 1560
Width = 1815
End
Begin VB.TextBox Text2
Height = 390
Left = 1560
TabIndex = 2
Top = 960
Width = 5775
End
Begin VB.Frame Frame1
Height = 3735
Left = 120
TabIndex = 0
Top = 0
Width = 7815
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel7
Height = 255
Left = 4320
OleObjectBlob = "frmaddbookinfo.frx":0234
TabIndex = 16
Top = 1560
Width = 855
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel6
Height = 375
Left = 4320
OleObjectBlob = "frmaddbookinfo.frx":029A
TabIndex = 15
Top = 2280
Width = 975
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel5
Height = 255
Left = 360
OleObjectBlob = "frmaddbookinfo.frx":0300
TabIndex = 14
Top = 3120
Width = 735
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel4
Height = 255
Left = 360
OleObjectBlob = "frmaddbookinfo.frx":0364
TabIndex = 13
Top = 2400
Width = 615
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel3
Height = 255
Left = 360
OleObjectBlob = "frmaddbookinfo.frx":03C8
TabIndex = 12
Top = 1680
Width = 855
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel2
Height = 255
Left = 360
OleObjectBlob = "frmaddbookinfo.frx":042C
TabIndex = 11
Top = 1080
Width = 615
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1
Height = 255
Left = 360
OleObjectBlob = "frmaddbookinfo.frx":0490
TabIndex = 10
Top = 360
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1440
TabIndex = 7
Top = 1680
Width = 1815
End
Begin VB.TextBox Text1
Height = 390
Left = 1440
TabIndex = 1
Top = 240
Width = 1815
End
End
End
Attribute VB_Name = "frmaddbookinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim rs_addbook 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
If Trim(Combo1.Text) = "" Then
MsgBox "请选择图书种类", vbOKOnly + vbExclamation, ""
Combo1.SetFocus
Exit Sub
End If
If Not IsDate(Text5.Text) Then
MsgBox "请按照yyyy-mm-dd格式输入日期", vbOKOnly + vbExclamation, ""
Text5.SetFocus
Exit Sub
End If
If Not IsDate(Text6.Text) Then
MsgBox "请按照yyyy-mm-dd格式输入日期", vbOKOnly + vbExclamation, ""
Text6.SetFocus
Exit Sub
End If
sql = "select * from 书籍信息 where 图书编号='" & Text1.Text & "'"
rs_addbook.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_addbook.EOF Then
rs_addbook.AddNew
rs_addbook.Fields(0) = Trim(Text1.Text)
rs_addbook.Fields(1) = Trim(Text2.Text)
rs_addbook.Fields(2) = Trim(Combo1.Text)
rs_addbook.Fields(3) = Trim(Text3.Text)
rs_addbook.Fields(4) = Trim(Text4.Text)
rs_addbook.Fields(5) = Trim(Text5.Text)
rs_addbook.Fields(6) = Trim(Text6.Text)
rs_addbook.Fields(7) = "否"
rs_addbook.Update
MsgBox "添加书籍信息成功!", vbOKOnly, ""
rs_addbook.Close
Else
MsgBox "图书编号重复!", vbOKOnly + vbExclamation, ""
Text1.SetFocus
rs_addbook.Close
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim skn
skn = App.Path & "\Book.skn"
'载入时的一些脚本.
Skin1.LoadSkin skn
Skin1.ApplySkin Me.hWnd ' 应用皮肤到这个窗口和它的子控件中
Dim rs_leibie As New ADODB.Recordset
Dim sql As String
sql = "select * from 图书类别"
rs_leibie.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_leibie.MoveFirst
Do While Not rs_leibie.EOF
Combo1.AddItem rs_leibie.Fields(0)
rs_leibie.MoveNext
Loop
rs_leibie.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -