📄 frmaddresult.frm
字号:
VERSION 5.00
Begin VB.Form frmAddresult
Caption = "添加成绩信息"
ClientHeight = 3132
ClientLeft = 48
ClientTop = 348
ClientWidth = 6744
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 3132
ScaleWidth = 6744
Begin VB.ComboBox comboExamtype
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 312
ItemData = "frmAddresult.frx":0000
Left = 1800
List = "frmAddresult.frx":0002
TabIndex = 13
Top = 360
Width = 1332
End
Begin VB.ComboBox comboCourse
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 312
ItemData = "frmAddresult.frx":0004
Left = 1800
List = "frmAddresult.frx":0006
TabIndex = 11
Top = 1440
Width = 1332
End
Begin VB.CommandButton cmdCancel
Caption = "取消添加"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 3360
TabIndex = 9
Top = 2040
Width = 1332
End
Begin VB.CommandButton cmdOk
Caption = "确认添加"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 492
Left = 1440
TabIndex = 8
Top = 2040
Width = 1332
End
Begin VB.TextBox txtResult
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 4800
TabIndex = 7
Top = 1320
Width = 1332
End
Begin VB.TextBox txtName
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 4800
TabIndex = 5
Top = 840
Width = 1332
End
Begin VB.ComboBox comboSID
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 312
ItemData = "frmAddresult.frx":0008
Left = 1800
List = "frmAddresult.frx":000A
TabIndex = 3
Top = 840
Width = 1332
End
Begin VB.ComboBox comboClassno
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 312
ItemData = "frmAddresult.frx":000C
Left = 4800
List = "frmAddresult.frx":000E
TabIndex = 1
Top = 360
Width = 1332
End
Begin VB.Label Label6
Caption = "考试编号:"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 480
TabIndex = 12
Top = 360
Width = 1212
End
Begin VB.Label Label5
Caption = "选择课程:"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 480
TabIndex = 10
Top = 1440
Width = 1212
End
Begin VB.Label Label4
Caption = "输入分数:"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3600
TabIndex = 6
Top = 1440
Width = 1332
End
Begin VB.Label Label3
Caption = "姓名:"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3600
TabIndex = 4
Top = 960
Width = 732
End
Begin VB.Label Label2
Caption = "选择学号:"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 480
TabIndex = 2
Top = 840
Width = 1212
End
Begin VB.Label Label1
Caption = "选择班号:"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3360
TabIndex = 0
Top = 360
Width = 1332
End
End
Attribute VB_Name = "frmAddresult"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Flagselect As Boolean
Dim Grade As String
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
If Not Testtxt(comboExamtype.Text) Then
MsgBox "请输入考试编号!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If Not Testtxt(comboClassno.Text) Then
MsgBox "请选择班号!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If Not Testtxt(comboSID.Text) Then
MsgBox "请选择学号!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If Not Testtxt(comboCourse.Text) Then
MsgBox "请选择课程!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If Not Testtxt(txtResult.Text) Then
MsgBox "请输入分数!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If Not IsNumeric(txtResult.Text) Then
MsgBox "分数请输入数字!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
txtSQL = "select * from result_Info where exam_No = '" & comboExamtype.Text & "' and student_ID = '" & comboSID.Text & "' and course_Name = '" & comboCourse.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "有相同纪录,请重新输入信息!", vbOKOnly + vbExclamation, "警告"
mrc.Close
Else
mrc.AddNew
mrc.Fields(0) = comboExamtype.Text
mrc.Fields(1) = comboSID.Text
mrc.Fields(2) = txtName.Text
mrc.Fields(3) = comboClassno.Text
mrc.Fields(4) = comboCourse.Text
mrc.Fields(5) = txtResult.Text
mrc.Update
mrc.Close
MsgBox "添加成绩成功!", vbOKOnly + vbExclamation, "警告"
Unload Me
End If
End Sub
Private Sub comboClassno_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
comboSID.Clear
comboCourse.Clear
txtSQL = "select * from student_Info where class_NO = '" & comboClassno.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
While (mrc.EOF = False)
comboSID.AddItem mrc!student_ID
mrc.MoveNext
Wend
mrc.Close
txtSQL = "select * from class_Info where class_No = '" & comboClassno.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
Grade = mrc!Grade
mrc.Close
txtSQL = "select * from gradecourse_Info where grade = '" & Grade & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
While (mrc.EOF = False)
comboCourse.AddItem mrc!course_Name
mrc.MoveNext
Wend
mrc.Close
Flagselect = True
End Sub
Private Sub comboCourseno_Change()
End Sub
Private Sub comboSID_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
txtSQL = "select * from student_Info where student_ID = '" & comboSID.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
txtName.Text = mrc!student_Name
mrc.Close
End Sub
Private Sub Form_Load()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
Flagselect = False
txtSQL = "select * from class_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
While (mrc.EOF = False)
comboClassno.AddItem mrc!class_No
mrc.MoveNext
Wend
mrc.Close
comboExamtype.AddItem "2000期中"
comboExamtype.AddItem "2000期末"
comboExamtype.AddItem "2001期中"
comboExamtype.AddItem "2001期末"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -