📄 修改&删除学生信息.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form stu_cd
BorderStyle = 1 'Fixed Single
Caption = "修改&删除学生信息"
ClientHeight = 4785
ClientLeft = 3810
ClientTop = 3450
ClientWidth = 7650
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4785
ScaleWidth = 7650
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 600
Top = 4440
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=stu_manage"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=stu_manage"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "sa"
Password = "manager"
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command4
Caption = "删除"
Height = 375
Left = 5880
TabIndex = 5
Top = 4200
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "修改"
Height = 375
Left = 4440
TabIndex = 4
Top = 4200
Width = 1215
End
Begin VB.Frame Frame1
Caption = "查询结果"
Height = 3375
Left = 240
TabIndex = 3
Top = 600
Width = 7095
Begin VB.ComboBox Combo5
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 28
Top = 2040
Width = 1575
End
Begin VB.TextBox Text8
Height = 375
Left = 4440
TabIndex = 26
Top = 2640
Width = 1335
End
Begin VB.ComboBox Combo4
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 24
Top = 2640
Width = 1575
End
Begin VB.ComboBox Combo3
Height = 300
Left = 4440
Style = 2 'Dropdown List
TabIndex = 22
Top = 2040
Width = 2415
End
Begin VB.TextBox Text6
Height = 375
Left = 5760
TabIndex = 19
Top = 1440
Width = 1095
End
Begin VB.TextBox Text5
Height = 375
Left = 1320
TabIndex = 17
Top = 1440
Width = 3015
End
Begin VB.ComboBox Combo2
Height = 300
Left = 3720
Style = 2 'Dropdown List
TabIndex = 15
Top = 840
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 13
Top = 840
Width = 1335
End
Begin VB.TextBox Text4
Height = 375
Left = 5760
TabIndex = 11
Top = 240
Width = 855
End
Begin VB.TextBox Text3
Height = 375
Left = 3720
TabIndex = 9
Top = 240
Width = 495
End
Begin VB.TextBox Text2
Height = 375
Left = 1320
TabIndex = 7
Top = 240
Width = 1095
End
Begin VB.Label Label12
Caption = "班 级"
Height = 255
Left = 3480
TabIndex = 25
Top = 2640
Width = 735
End
Begin VB.Label Label11
Caption = "专 业"
Height = 255
Left = 360
TabIndex = 23
Top = 2760
Width = 735
End
Begin VB.Label Label10
Caption = "学 院"
Height = 255
Left = 3480
TabIndex = 21
Top = 2160
Width = 735
End
Begin VB.Label Label9
Caption = "入学年份"
Height = 255
Left = 360
TabIndex = 20
Top = 2160
Width = 735
End
Begin VB.Label Label8
Caption = "邮政编码"
Height = 255
Left = 4680
TabIndex = 18
Top = 1560
Width = 735
End
Begin VB.Label Label7
Caption = "家庭住址"
Height = 255
Left = 360
TabIndex = 16
Top = 1560
Width = 735
End
Begin VB.Label Label6
Caption = "政治面貌"
Height = 255
Left = 2760
TabIndex = 14
Top = 960
Width = 735
End
Begin VB.Label Label5
Caption = "民 族"
Height = 255
Left = 360
TabIndex = 12
Top = 960
Width = 735
End
Begin VB.Label Label4
Caption = "出生年月"
Height = 255
Left = 4680
TabIndex = 10
Top = 360
Width = 735
End
Begin VB.Label Label3
Caption = "性 别"
Height = 255
Left = 2760
TabIndex = 8
Top = 360
Width = 735
End
Begin VB.Label Label2
Caption = "姓 名"
Height = 255
Left = 360
TabIndex = 6
Top = 360
Width = 735
End
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 2160
TabIndex = 2
Top = 120
Width = 855
End
Begin VB.TextBox Text1
Height = 375
Left = 960
TabIndex = 1
Top = 120
Width = 1095
End
Begin VB.Label unshow
Height = 255
Left = 5520
TabIndex = 27
Top = 120
Visible = 0 'False
Width = 975
End
Begin VB.Label Label1
Caption = "学号"
Height = 255
Left = 360
TabIndex = 0
Top = 240
Width = 495
End
End
Attribute VB_Name = "stu_cd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public rs As New ADODB.Recordset
Public adoconn As New ADODB.Connection 'Connection 对象代表了打开与数据源的连接。
'从文本输入框获取数据的变量声明
Public stu_name As String '姓名
Public sex As String '性别
Public birth As String '出生年月
Public policy As String '政治面貌
Public policy_id As Integer '政治面貌对应编号
Public nation As String '民族
Public nation_id As Integer '民族对应编号
Public address As String '家庭住址
Public post As String '邮政编码
Public stu_no As String '学号
Public enter As String '入学年份
Public college As String '学院
Public college_id As Integer '学院对应编号
Public major As String '专业
Public major_count As Integer '专业个数
Public major_id As Integer ' 专业对应编号
Public class As String '班级
'为连接数据库作好准备
Public Sub connect()
adoconn.ConnectionString = Adodc1.ConnectionString 'Adodc1为窗体中的ADO控件,并已成功连接数据库
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
End Sub
'选择民族
Private Sub Combo1_Click()
nation = Combo1.Text
adoconn.Open
rs.Open "select * from nation where name='" & nation & "'", adoconn
If rs.Fields("name") = nation Then
nation_id = rs.Fields("id")
End If
rs.Close
adoconn.Close
End Sub
'加载专业列表
Public Sub major_combo()
adoconn.Open
Combo4.clear
Dim i As Integer
'获取所有专业总数
rs.Open "select * from major", adoconn
major_count = rs.RecordCount
'总数不为零,则找出该学院对应专业
Combo4.clear
If major_count <> 0 Then
rs.MoveFirst
For i = 0 To rs.RecordCount - 1
If college_id = rs.Fields("college") Then
Combo4.AddItem rs.Fields("name")
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -