?? frmbookupdate.frm
字號:
VERSION 5.00
Begin VB.Form frmBookUpdate
Caption = "修改書籍信息"
ClientHeight = 7275
ClientLeft = 60
ClientTop = 450
ClientWidth = 7890
LinkTopic = "Form6"
ScaleHeight = 7275
ScaleWidth = 7890
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "更新"
Height = 375
Left = 840
TabIndex = 17
Top = 6240
Width = 975
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 375
Left = 3840
TabIndex = 16
Top = 6240
Width = 975
End
Begin VB.CommandButton Command1
Caption = "清空"
Height = 375
Left = 2280
TabIndex = 15
Top = 6240
Width = 975
End
Begin VB.TextBox txtPress
Height = 375
Left = 2520
TabIndex = 14
Top = 1680
Width = 2415
End
Begin VB.TextBox txtAuthor
Height = 375
Left = 2520
TabIndex = 13
Top = 2400
Width = 2415
End
Begin VB.TextBox txtAddress
Height = 375
Left = 2520
TabIndex = 12
Top = 3120
Width = 2415
End
Begin VB.TextBox txtDate
Height = 375
Left = 2520
TabIndex = 11
Top = 3840
Width = 2415
End
Begin VB.TextBox txtPrice
Height = 375
Left = 2520
TabIndex = 10
Top = 4560
Width = 2415
End
Begin VB.TextBox txtNumber
Height = 375
Left = 2520
TabIndex = 9
Top = 5280
Width = 2415
End
Begin VB.TextBox txtName
Height = 375
Left = 2520
TabIndex = 8
Top = 960
Width = 2415
End
Begin VB.Label Label8
Caption = "價格"
Height = 255
Left = 720
TabIndex = 7
Top = 4560
Width = 1095
End
Begin VB.Label Label7
Caption = "圖書編號(唯一確定)"
Height = 255
Left = 720
TabIndex = 6
Top = 5280
Width = 1695
End
Begin VB.Label Label6
Caption = "出版社"
Height = 255
Left = 720
TabIndex = 5
Top = 1680
Width = 1095
End
Begin VB.Label Label5
Caption = "作者"
Height = 255
Left = 720
TabIndex = 4
Top = 2400
Width = 855
End
Begin VB.Label Label4
Caption = "地址"
Height = 255
Left = 720
TabIndex = 3
Top = 3120
Width = 975
End
Begin VB.Label Label3
Caption = "出版日期"
Height = 255
Left = 720
TabIndex = 2
Top = 3840
Width = 1215
End
Begin VB.Label Label2
Caption = "名稱"
Height = 255
Left = 720
TabIndex = 1
Top = 960
Width = 975
End
Begin VB.Label Label1
Caption = "請輸入書名點確定,調出此書相關信息"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 0
Top = 240
Width = 4335
End
End
Attribute VB_Name = "frmBookUpdate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
txtName.Text = ""
txtPress.Text = ""
txtAuthor.Text = ""
txtAddress.Text = ""
txtDate.Text = ""
txtPrice.Text = ""
txtNumber.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Dim conn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Dim N As Boolean
N = True
If Trim(txtName.Text) = "" Then
MsgBox "書名不能為空", vbOKOnly + vbExclamation, ""
txtName.SetFocus
N = False
End If
If Trim(txtPress.Text) = "" Then
MsgBox "出版社不能為空", vbOKOnly + vbExclamation, ""
txtPress.SetFocus
N = False
End If
If Trim(txtAuthor.Text) = "" Then
MsgBox "作者不能為空", vbOKOnly + vbExclamation, ""
txtAuthor.SetFocus
N = False
End If
If Trim(txtAddress.Text) = "" Then
MsgBox "地址不能為空", vbOKOnly + vbExclamation, ""
txtAddress.SetFocus
N = False
End If
If Trim(txtDate.Text) = "" Then
MsgBox "出版日期不能為空", vbOKOnly + vbExclamation, ""
txtDate.SetFocus
N = False
End If
If Trim(txtPrice.Text) = "" Then
MsgBox "價格不能為空", vbOKOnly + vbExclamation, ""
txtPrice.SetFocus
N = False
End If
If Trim(txtNumber.Text) = "" Then
MsgBox "圖書編號不能為空", vbOKOnly + vbExclamation, ""
txtNumber.SetFocus
N = False
End If
If N = False Then
MsgBox "更新書籍信息失敗", vbOKOnly
Else
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=book.mdb;Persist Security Info=False"
conn.Open
sql = "select*from BookInfo where BookNumber='" + txtNumber.Text + "'"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
If Not rs.EOF Then
rs.Fields(0) = Trim(txtNumber.Text)
rs.Fields(1) = Trim(txtName.Text)
rs.Fields(2) = Trim(txtPress.Text)
rs.Fields(3) = Trim(txtAuthor.Text)
rs.Fields(4) = Trim(txtAddress.Text)
rs.Fields(5) = Trim(txtDate.Text)
rs.Fields(6) = Trim(txtPrice.Text)
rs.Update
MsgBox "更新書籍信息成功!", vbOKOnly, ""
rs.Close
Else
MsgBox "圖書編號不存在!", vbOKOnly + vbExclamation, ""
txtNumber.SetFocus
txtNumber.Text = ""
rs.Close
End If
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -