?? frmedittitle.frm
字號:
VERSION 5.00
Begin VB.Form FrmEditTitle
Caption = "編輯書種界面"
ClientHeight = 4545
ClientLeft = 60
ClientTop = 450
ClientWidth = 5100
LinkTopic = "Form1"
ScaleHeight = 4545
ScaleWidth = 5100
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdExit
Caption = "關閉"
Height = 375
Left = 2760
TabIndex = 9
Top = 3960
Width = 975
End
Begin VB.CommandButton cmdEnter
Caption = "確定"
Height = 375
Left = 1200
TabIndex = 8
Top = 3960
Width = 975
End
Begin VB.Frame Frame1
Caption = "編輯信息"
Height = 3615
Left = 240
TabIndex = 0
Top = 240
Width = 4575
Begin VB.TextBox txtAuthor
Height = 315
Left = 1920
TabIndex = 3
Top = 1320
Width = 1800
End
Begin VB.TextBox txtIsbsn
Height = 315
Left = 1920
TabIndex = 2
Top = 2040
Width = 1800
End
Begin VB.ComboBox Combo1
Height = 315
Left = 1920
TabIndex = 1
Top = 2760
Width = 1800
End
Begin VB.Label lblName
Height = 255
Left = 1920
TabIndex = 10
Top = 600
Width = 1815
End
Begin VB.Label Label4
Caption = "種類:"
Height = 255
Left = 600
TabIndex = 7
Top = 2760
Width = 1335
End
Begin VB.Label Label3
Caption = "ISBSN:"
Height = 255
Left = 600
TabIndex = 6
Top = 2040
Width = 1335
End
Begin VB.Label Label2
Caption = "作者:"
Height = 255
Left = 600
TabIndex = 5
Top = 1320
Width = 1335
End
Begin VB.Label Label1
Caption = "書名:"
Height = 255
Left = 600
TabIndex = 4
Top = 600
Width = 1335
End
End
End
Attribute VB_Name = "FrmEditTitle"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdEnter_Click()
'檢驗數據的有效性
If Trim(txtAuthor) = "" Then
MsgBox "請輸入作者"
Exit Sub
End If
If Trim(txtIsbsn) = "" Then
MsgBox "請輸入ISBSN"
Exit Sub
End If
Dim myDbOper As New DbOperation
Dim rst As ADODB.Recordset
Dim sql As String
'建立連接
myDbOper.DB_Connect
'定義查詢語句
sql = "SELECT * FROM Title WHERE Name='" + Trim(lblName) + "'"
Set rst = myDbOper.querySQL(sql)
If (Not rst.EOF) Then
rst!author = Me.txtAuthor
rst!isbsn = Me.txtIsbsn
rst!Type = Me.Combo1.Text
rst.Update
MsgBox "信息修改成功."
Else
MsgBox "發生錯誤,請重新輸入."
End If
rst.Close
'關閉連接
myDbOper.DB_DisConnect
End Sub
Private Sub cmdExit_Click()
Me.Hide
End Sub
Private Sub Form_Activate()
Dim myDbOper As New DbOperation
Dim rst As ADODB.Recordset
Dim sql As String
'建立連接
myDbOper.DB_Connect
'定義查詢語句
sql = "SELECT * FROM Title WHERE Name='" + Trim(lblName) + "'"
Set rst = myDbOper.querySQL(sql)
If (Not rst.EOF) Then
Me.txtAuthor = rst!author
Me.txtIsbsn = rst!isbsn
Me.Combo1.Text = rst!Type
Else
MsgBox "發生錯誤,請重新輸入."
End If
rst.Close
'關閉連接
myDbOper.DB_DisConnect
End Sub
Private Sub Form_Load()
'初始化類型列表框
Dim buildCombo As New BuildComboList
Dim type_sql As String
'定義查詢書種的SQL語句
type_sql = "SELECT DISTINCT type FROM Title"
Combo1 = buildCombo.getList(type_sql, Combo1)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -