📄 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 + -