📄 修改学生基本信息.frm
字号:
VERSION 5.00
Begin VB.Form 学生基本信息
Caption = "Form2"
ClientHeight = 6090
ClientLeft = 60
ClientTop = 345
ClientWidth = 8235
LinkTopic = "Form2"
ScaleHeight = 6090
ScaleWidth = 8235
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text5
Height = 615
Left = 1800
TabIndex = 23
Top = 1560
Width = 1335
End
Begin VB.ComboBox Combo6
Height = 300
Left = 6120
TabIndex = 22
Text = " "
Top = 4080
Width = 1935
End
Begin VB.TextBox Text4
Height = 615
Left = 6240
TabIndex = 21
Text = " "
Top = 2040
Width = 1935
End
Begin VB.TextBox Text3
Height = 735
Left = 6120
TabIndex = 20
Text = " "
Top = 960
Width = 2055
End
Begin VB.TextBox Text2
Height = 495
Left = 6000
TabIndex = 19
Text = " "
Top = 120
Width = 2175
End
Begin VB.TextBox Text1
Height = 615
Left = 1680
TabIndex = 18
Text = " "
Top = 3600
Width = 1335
End
Begin VB.ComboBox Combo4
Height = 300
Left = 1560
TabIndex = 17
Text = " "
Top = 4680
Width = 1455
End
Begin VB.ComboBox Combo3
Height = 300
Left = 1680
TabIndex = 16
Text = " "
Top = 2640
Width = 1455
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1800
TabIndex = 15
Text = " "
Top = 840
Width = 1455
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1800
TabIndex = 14
Text = " "
Top = 240
Width = 1455
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 2655
Left = 3480
TabIndex = 0
Top = 3360
Width = 2295
Begin VB.CommandButton Command4
Caption = " 查询"
Height = 495
Left = 240
TabIndex = 24
Top = 240
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 495
Left = 240
TabIndex = 3
Top = 2040
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 495
Left = 240
TabIndex = 2
Top = 1440
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "修改"
Height = 495
Left = 240
TabIndex = 1
Top = 840
Width = 1455
End
End
Begin VB.Label Label10
Caption = "班级编号"
Height = 735
Left = 6000
TabIndex = 13
Top = 3000
Width = 2055
End
Begin VB.Label Label9
Caption = "邮政编码"
Height = 615
Left = 3960
TabIndex = 12
Top = 2040
Width = 1935
End
Begin VB.Label Label8
Caption = "联系电话"
Height = 735
Left = 3960
TabIndex = 11
Top = 960
Width = 1695
End
Begin VB.Label Label7
Caption = "家庭住址"
Height = 495
Left = 3960
TabIndex = 10
Top = 120
Width = 1695
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "政治面貌"
Height = 180
Left = 120
TabIndex = 9
Top = 4680
Width = 720
End
Begin VB.Label Label5
Caption = "出生日期"
Height = 615
Left = 120
TabIndex = 8
Top = 3600
Width = 1215
End
Begin VB.Label Label4
Caption = "族别"
Height = 615
Left = 120
TabIndex = 7
Top = 2520
Width = 1215
End
Begin VB.Label Label3
Caption = "性别"
Height = 615
Left = 120
TabIndex = 6
Top = 1560
Width = 1215
End
Begin VB.Label Label2
Caption = "姓名"
Height = 495
Left = 120
TabIndex = 5
Top = 840
Width = 1215
End
Begin VB.Label Label1
Caption = "学号"
Height = 375
Left = 120
TabIndex = 4
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 rs5 As New ADODB.Recordset
Private Sub Combo1_Click()
Dim rs17 As New ADODB.Recordset
rs17.Open "select * from 学生基本信息表 where 学号='" + Trim(Combo1.Text) + "'", cnn, 3, 1
rs17.Find "学号= '" & Trim(Combo1.Text) & "'"
End Sub
Private Sub Combo2_Click()
Dim rs18 As New ADODB.Recordset
rs18.Open "select * from 学生基本信息表 where 姓名='" + Trim(Combo2.Text) + "'", cnn, 3, 1
rs18.Find "姓名= '" & Trim(Combo2.Text) & "'"
End Sub
Private Sub Combo3_Click()
Dim rs19 As New ADODB.Recordset
rs19.Open "select * from 学生基本信息表 where 族别 ='" + Trim(Combo3.Text) + "'", cnn, 3, 1
rs19.Find "族别= '" & Trim(Combo3.Text) & "'"
End Sub
Private Sub Combo6_Click()
Dim rs119 As New ADODB.Recordset
rs119.Open "select * from 班级表 where 班级编号='" + Trim(Combo6.Text) + "'", cnn, 3, 1
rs119.Find "班级编号= '" & Trim(Combo6.Text) & "'"
End Sub
Private Sub Command1_Click()
If rs5.State <> 0 Then rs5.Close
rs5.Open "select * from 学生基本信息表 where 学号='" & Trim(Combo1.Text) & "'", cnn, 3, 3
rs5.Find "学号 like '" & Combo1.Text & "'"
If rs5.EOF Then
MsgBox "没有此记录!"
Combo1.Text = ""
Else
rs5.Find "学号= '" & Trim(Combo1.Text) & "'"
rs5("学号") = Combo1.Text
rs5("姓名") = Combo2.Text
rs5("性别") = Text5
rs5("族别") = Combo3.Text
rs5("出生日期") = Text1
rs5("政治面貌") = Combo4.Text
rs5("家庭住址") = Text2
rs5("邮政编码") = Text4
rs5("联系电话") = Text3
rs5("班级编号") = Combo6.Text
rs5.Update
rs5.Requery
MsgBox "修改信息成功!"
Combo1.Text = ""
Combo2.Text = ""
Text5 = ""
Combo3.Text = ""
Text1 = ""
Combo4.Text = ""
Text2 = ""
Text4 = ""
Text3 = ""
Combo6.Text = ""
End If
End Sub
Private Sub Command2_Click()
If rs5.State <> 0 Then rs5.Close
rs5.Open "select * from 学生基本信息表 where 学号='" & Trim(Combo1.Text) & "'", cnn, 3, 3
rs5.Find "学号 like '" & Combo1.Text & "'"
If rs5.EOF Then
MsgBox ""
Else
rs5.Delete
rs5.Update
MsgBox "删除信息成功!"
Combo1.Text = ""
Text5 = ""
Combo3.Text = ""
Text1 = ""
Combo4.Text = ""
Text2 = ""
Text4 = ""
Text3 = ""
Combo6.Text = ""
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
If rs5.State <> 0 Then rs5.Close
rs5.Open "select* from 学生基本信息表", cnn, 3, 1
rs5.Find "学号 like '" & Combo1.Text & "'"
If rs5.EOF Then
MsgBox "没有此记录!"
Combo1.Text = ""
Exit Sub
Else
Combo1.Text = rs5("学号")
Combo2.Text = rs5("姓名")
Text5 = rs5("性别")
Combo3.Text = rs5("族别")
Text1 = rs5("出生日期")
Combo4.Text = rs5("政治面貌")
Text2 = rs5("家庭住址")
Text4 = rs5("邮政编码")
Text3 = rs5("联系电话")
Combo6.Text = rs5("班级编号")
End If
End Sub
Private Sub Form_Load()
Dim rs15 As New Recordset
rs15.Open "select * from 班级表", cnn, 3, 3
Do While Not rs15.EOF
Combo6.AddItem rs15("班级编号")
rs15.MoveNext
Loop
rs15.Close
rs15.Open "select * from 学生基本信息表", cnn, 3, 3
Do While Not rs15.EOF
Combo1.AddItem rs15("学号")
Combo2.AddItem rs15("姓名")
Combo3.AddItem rs15("族别")
rs15.MoveNext
Loop
rs15.Close
Combo4.AddItem "团员"
Combo4.AddItem "党员"
Combo4.AddItem "群众"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -