📄 form10.frm
字号:
VERSION 5.00
Begin VB.Form Form10
BorderStyle = 3 'Fixed Dialog
Caption = "编辑教师信息"
ClientHeight = 4980
ClientLeft = 45
ClientTop = 375
ClientWidth = 6015
LinkTopic = "Form10"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4980
ScaleWidth = 6015
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Index = 6
Left = 3480
TabIndex = 11
Top = 3720
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "修改"
Height = 375
Index = 5
Left = 2280
TabIndex = 10
Top = 3720
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Index = 4
Left = 960
TabIndex = 9
Top = 3720
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "尾记录"
Height = 375
Index = 3
Left = 3840
TabIndex = 8
Top = 3360
Width = 975
End
Begin VB.CommandButton Command1
Caption = "下一记录"
Height = 375
Index = 2
Left = 2880
TabIndex = 7
Top = 3360
Width = 975
End
Begin VB.CommandButton Command1
Caption = "上一记录"
Height = 375
Index = 1
Left = 1920
TabIndex = 6
Top = 3360
Width = 975
End
Begin VB.CommandButton Command1
Caption = "首记录"
Height = 375
Index = 0
Left = 960
TabIndex = 5
Top = 3360
Width = 975
End
Begin VB.Frame Frame1
Caption = "教师信息"
Height = 2295
Left = 1080
TabIndex = 0
Top = 600
Width = 3615
Begin VB.TextBox Text2
Height = 375
Left = 1680
TabIndex = 2
Top = 1320
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 1680
TabIndex = 1
Top = 600
Width = 1095
End
Begin VB.Label Label2
Caption = "教师姓名:"
Height = 255
Left = 720
TabIndex = 4
Top = 1440
Width = 1095
End
Begin VB.Label Label1
Caption = "教师编号:"
Height = 255
Left = 720
TabIndex = 3
Top = 720
Width = 1335
End
End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_test As New ADODB.Recordset
Private Sub Form_Load()
Dim sql As String
sql = "select * from teacher"
Call Conn
rs_test.Open sql, Module1.conn_mdb, 3, 3
rs_test.MoveFirst
Call shows
X = 0
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 '首记录
rs_test.MoveFirst
Call shows
Case 1 '上一记录
If Not rs_test.BOF Then
rs_test.MovePrevious
Call shows
End If
Case 2 '下一记录
If Not rs_test.EOF Then
rs_test.MoveNext
Call shows
End If
Case 3 '尾记录
rs_test.MoveLast
Call shows
Case 4 '添加
rs_test.AddNew
rs_test("t_id") = Text1.Text
rs_test("t_name") = Text2.Text
rs_test.Update
Case 5 '编辑
rs_test("t_id") = Text1.Text
rs_test("t_name") = Text2.Text
rs_test.Update
Case 6 '删除
rs_test.Delete
rs_test.Update
rs_test.MoveFirst
End Select
End Sub
Private Sub shows()
If Not rs_test.EOF And Not rs_test.BOF Then
Text1.Text = rs_test("t_id")
Text2.Text = rs_test("t_name")
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call conclose
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -