📄 frmscore.frm
字号:
VERSION 5.00
Begin VB.Form frmscore
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "录入学生成绩"
ClientHeight = 7305
ClientLeft = 45
ClientTop = 435
ClientWidth = 4095
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7305
ScaleWidth = 4095
Begin VB.CommandButton Command1
Caption = "确认"
Height = 420
Left = 720
TabIndex = 10
Top = 6600
Width = 1050
End
Begin VB.Frame Frame2
BackColor = &H00FFFFFF&
Caption = "按班级输入:"
Height = 5175
Left = 120
TabIndex = 4
Top = 2040
Width = 3855
Begin VB.ComboBox cobcollege
Height = 300
Left = 1080
TabIndex = 15
Text = "cobcollege"
Top = 360
Width = 2295
End
Begin VB.OptionButton Option2
BackColor = &H00FFFFFF&
Caption = "按姓名显示"
Height = 255
Left = 2160
TabIndex = 13
Top = 1695
Width = 1215
End
Begin VB.OptionButton Option1
BackColor = &H00FFFFFF&
Caption = "按学号显示"
Height = 255
Left = 120
TabIndex = 12
Top = 1695
Width = 1215
End
Begin VB.CommandButton CmdQuit
Cancel = -1 'True
Caption = "返回"
Height = 420
Left = 2160
TabIndex = 11
Top = 4560
Width = 1050
End
Begin VB.ListBox List1
Height = 2400
Left = 120
TabIndex = 9
Top = 2040
Width = 3615
End
Begin VB.ComboBox cobclass
Height = 300
Left = 1080
TabIndex = 8
Text = "cobclass"
Top = 1320
Width = 2295
End
Begin VB.ComboBox cobsp
Height = 300
Left = 1080
TabIndex = 6
Text = "cobsp"
Top = 840
Width = 2295
End
Begin VB.Label Label4
BackColor = &H00FFFFFF&
Caption = "学院:"
Height = 255
Left = 240
TabIndex = 14
Top = 360
Width = 615
End
Begin VB.Label Label3
BackColor = &H00FFFFFF&
Caption = "班级:"
Height = 255
Left = 240
TabIndex = 7
Top = 1320
Width = 735
End
Begin VB.Label Label2
BackColor = &H00FFFFFF&
Caption = "专业:"
Height = 255
Left = 240
TabIndex = 5
Top = 840
Width = 615
End
End
Begin VB.Frame Frame1
BackColor = &H00FFFFFF&
Caption = "按学号输入:"
Height = 1770
Left = 120
TabIndex = 0
Top = 120
Width = 3825
Begin VB.TextBox txtID
Height = 330
Left = 1560
TabIndex = 2
Top = 480
Width = 1965
End
Begin VB.CommandButton CmdOK
Caption = "确认"
Default = -1 'True
Height = 420
Left = 1440
TabIndex = 1
Top = 1080
Width = 1050
End
Begin VB.Label Label1
BackColor = &H00FFFFFF&
Caption = "输入学号:"
Height = 360
Left = 480
TabIndex = 3
Top = 480
Width = 945
End
End
End
Attribute VB_Name = "frmscore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sk As String
Private Sub CmdOK_Click()
Dim sCon As String
If txtID.Text = "" Then
txtID.Text = "请输学号"
txtID.SelStart = 0
txtID.SelLength = Len(txtID.Text)
txtID.SetFocus
Exit Sub
End If
sCon = "select * from student where id='" & txtID.Text & "'"
Set adoRS = adoCon.Execute(sCon)
If adoRS.EOF Then
MsgBox "对不起,查无此人,请执行系统查询功能," _
& vbCrLf & vbCrLf & "确认要录入成绩的学生学号后再进行录入。", _
vbInformation + vbOKOnly, "系统提示"
txtID.SetFocus
txtID.SelStart = 0
txtID.SelLength = Len(txtID.Text)
Exit Sub
Else
sk = Trim(txtID.Text)
Me.Hide
frmscorein.Show
End If
End Sub
Private Sub cmdQuit_Click()
Unload Me
End Sub
Private Sub cobclass_Click()
If Option1.Value = True Then
Option1.Value = False
End If
If Option2.Value = True Then
Option2.Value = False
End If
End Sub
Private Sub cobcollege_Click()
'专业
SQL = ""
SQL = "select 专业 from Spcollege where 学院='" & cobcollege.Text & "'"
Set adoRS = adoCon.Execute(SQL)
cobsp.Clear
Do While Not adoRS.EOF
cobsp.AddItem Trim(adoRS("专业"))
adoRS.MoveNext
Loop
cobsp.ListIndex = 0
Option1.Value = False
Option2.Value = False
End Sub
Private Sub cobsp_Click()
'班级
SQL = ""
SQL = "select 班级 from Spclass where 专业='" & cobsp.Text & "'"
Set adoRS = adoCon.Execute(SQL)
cobclass.Clear
Do While Not adoRS.EOF
cobclass.AddItem Trim(adoRS("班级"))
adoRS.MoveNext
Loop
Option1.Value = False
Option2.Value = False
End Sub
Private Sub Command1_Click()
Dim sCon As String
If List1.ListIndex < 0 Then
MsgBox "请选择学生", vbInformation + vbOKOnly, "系统提示"
Exit Sub
End If
If Option1.Value = True Then
sCon = "select * from student where ID='" & Trim(List1.Text) & "'"
Set adoRS = adoCon.Execute(sCon)
End If
If Option2.Value = True Then
sCon = "select * from student where Name='" & Trim(List1.Text) & "'"
Set adoRS = adoCon.Execute(sCon)
End If
If adoRS.EOF Then
MsgBox "对不起,查无此人,请执行系统查询功能," _
& vbCrLf & vbCrLf & "确认要录入成绩的学生学号后再进行录入。", _
vbInformation + vbOKOnly, "系统提示"
Exit Sub
Else
sk = Trim(List1.Text)
frmscorein.Show
Unload Me
End If
End Sub
Private Sub Form_Load()
Me.Width = 4215
Me.Height = 7785
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2 - 600
Me.Show
txtID.SetFocus
'学院
Set adoRS = adoCon.Execute("Select Name From College Order By Name")
cobsp.Clear
Do While Not adoRS.EOF
cobcollege.AddItem Trim(adoRS("Name"))
adoRS.MoveNext
Loop
cobcollege.ListIndex = 0
End Sub
Private Sub Option1_Click()
'学号
SQL = "select * from Student where Class='" & Trim(cobclass.Text) & "' order by ID "
Set adoRS = adoCon.Execute(SQL)
List1.Clear
Do While adoRS.EOF
MsgBox "该班尚未录入学生!", vbOKOnly + vbExclamation, "系统提示"
Exit Sub
Loop
If cobclass.Text = "" Then
MsgBox "请选择班级!", vbOKOnly + vbExclamation, "系统提示"
End If
Do While Not adoRS.EOF
List1.AddItem adoRS("ID")
adoRS.MoveNext
Loop
End Sub
Private Sub Option2_Click()
'姓名
SQL = "select * from Student where Class='" & Trim(cobclass.Text) & "' order by ID "
Set adoRS = adoCon.Execute(SQL)
List1.Clear
Do While adoRS.EOF
MsgBox "该班尚未录入学生!", vbOKOnly + vbExclamation, "系统提示"
Exit Sub
Loop
If cobclass.Text = "" Then
MsgBox "请选择班级!", vbOKOnly + vbExclamation, "系统提示"
End If
Do While Not adoRS.EOF
List1.AddItem adoRS("Name")
adoRS.MoveNext
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -