📄 修改系部信息.frm
字号:
VERSION 5.00
Begin VB.Form 系部信息
Caption = "Form1"
ClientHeight = 4920
ClientLeft = 60
ClientTop = 345
ClientWidth = 5610
LinkTopic = "Form1"
ScaleHeight = 4920
ScaleWidth = 5610
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo1
Height = 300
Left = 1320
TabIndex = 7
Text = " "
Top = 1080
Width = 1455
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 1335
Left = 240
TabIndex = 3
Top = 2280
Width = 4935
Begin VB.CommandButton Command1
Caption = "查询"
Height = 495
Left = 3840
TabIndex = 8
Top = 240
Width = 855
End
Begin VB.CommandButton Command4
Caption = "退出"
Height = 495
Left = 2520
TabIndex = 6
Top = 240
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "删除"
Height = 495
Left = 1320
TabIndex = 5
Top = 240
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "更新"
Height = 495
Left = 120
TabIndex = 4
Top = 240
Width = 1095
End
End
Begin VB.TextBox Text1
Height = 495
Left = 1440
TabIndex = 2
Text = " "
Top = 240
Width = 1095
End
Begin VB.Label Label2
Caption = "系部名称"
Height = 495
Left = 0
TabIndex = 1
Top = 960
Width = 1095
End
Begin VB.Label Label1
Caption = "系部编号"
Height = 495
Left = 120
TabIndex = 0
Top = 240
Width = 1095
End
End
Attribute VB_Name = "系部信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs31 As New ADODB.Recordset
Private Sub Combo1_Click()
Dim rs15 As New ADODB.Recordset
rs15.Open "select * from 系部表 where 系部编号='" + Trim(Combo1.Text) + "'", cnn, 3, 1
End Sub
Private Sub Command1_Click()
If rs31.State <> 0 Then rs31.Close
rs31.Open "select *from 系部表 where 系部编号='" + Trim(Text1) + "'", cnn, 3, 1
If rs31.EOF Then
MsgBox "没有此记录!"
Text1 = ""
Exit Sub
Else
Combo1.Text = rs31("系部名称")
Text1 = rs31("系部编号")
End If
End Sub
Private Sub Command2_Click()
If rs31.State <> 0 Then rs31.Close
rs31.Open "select * from 系部表 where 系部编号='" + Trim(Text1) + "'", cnn, 3, 3
rs31.Find "系部编号 like '" & Text1 & "'"
If rs31.EOF Then
MsgBox "没有此记录!"
Text1 = ""
Combo1.Text = ""
Else
rs31("系部名称") = Trim(Combo1.Text)
rs31("系部编号") = Trim(Text1)
rs31.Update
rs31.Requery
MsgBox "更新成功!"
End If
End Sub
Private Sub Command3_Click()
If rs31.State <> 0 Then rs31.Close
rs31.Open "select * from 系部表 where 系部编号='" + Trim(Text1) + "'", cnn, 3, 3
rs31.Find "系部编号 like '" & Text1 & "'"
If rs31.EOF Then
MsgBox ""
Else
rs31.Delete
rs31.Update
MsgBox "删除信息成功!"
Text1 = ""
Combo1.Text = ""
End If
End Sub
Private Sub Command4_Click()
Me.Hide
End Sub
Private Sub Form_Load()
Dim rs15 As New Recordset
rs15.Open "select * from 系部表", cnn, 3, 1
Do While Not rs15.EOF
Combo1.AddItem rs15("系部名称")
rs15.MoveNext
Loop
rs15.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -