📄 frmmodifyresult.frm
字号:
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "选择课程"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 960
TabIndex = 7
Top = 1515
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "考试编号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 960
TabIndex = 6
Top = 540
Width = 900
End
End
Attribute VB_Name = "frmModifyresult"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim myBookmark As Variant
Private Sub cancelCommand_Click()
mrc.Bookmark = myBookmark
Call viewData
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
editCommand.Enabled = True
updateCommand.Enabled = False
cancelCommand.Enabled = False
deleteCommand.Enabled = True
comboExamtype.Enabled = False
comboClassno.Enabled = False
comboSID.Enabled = False
comboCourse.Enabled = False
txtName.Enabled = False
txtResult.Enabled = False
End Sub
Private Sub comboSID_Click()
Dim mrcc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
txtSQL = "select * from student_Info where student_ID = '" & comboSID.Text & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
txtName.Text = mrcc!student_Name
mrcc.Close
End Sub
Private Sub deleteCommand_Click()
If mrc.RecordCount <> 1 Then
myBookmark = mrc.Bookmark
str2$ = MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录")
If str2$ = vbOK Then
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
myBookmark = mrc.Bookmark
mrc.MoveLast
mrc.Delete
mrc.Bookmark = myBookmark
Call viewData
Else
myBookmark = mrc.Bookmark
mrc.MovePrevious
mrc.Delete
mrc.Bookmark = myBookmark
Call viewData
End If
Else
mrc.Bookmark = myBookmark
Call viewData
End If
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
editCommand.Enabled = True
updateCommand.Enabled = False
cancelCommand.Enabled = False
deleteCommand.Enabled = True
Else
mrc.Delete
MsgBox "最后一条纪录已被删除!", vbOKOnly + vbExclamation, "警告"
Unload Me
End If
End Sub
Private Sub editCommand_Click()
Dim mrclist As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
'显示列表信息
txtSQL = "select * from class_Info "
Set mrclist = ExecuteSQL(txtSQL, MsgText)
While (mrclist.EOF = False)
comboClassno.AddItem mrclist!class_No
mrclist.MoveNext
Wend
mrclist.Close
txtSQL = "select * from student_Info "
Set mrclist = ExecuteSQL(txtSQL, MsgText)
While (mrclist.EOF = False)
comboSID.AddItem mrclist!student_ID
mrclist.MoveNext
Wend
mrclist.Close
txtSQL = "select * from course_Info "
Set mrclist = ExecuteSQL(txtSQL, MsgText)
While (mrclist.EOF = False)
comboCourse.AddItem mrclist!course_No
mrclist.MoveNext
Wend
mrclist.Close
Frame2.Enabled = False
firstCommand.Enabled = False
previousCommand.Enabled = False
nextCommand.Enabled = False
lastCommand.Enabled = False
editCommand.Enabled = False
updateCommand.Enabled = True
cancelCommand.Enabled = True
deleteCommand.Enabled = False
comboExamtype.Enabled = True
comboClassno.Enabled = True
comboSID.Enabled = True
comboCourse.Enabled = True
txtName.Enabled = True
txtResult.Enabled = True
comboExamtype.AddItem "2000期中"
comboExamtype.AddItem "2000期末"
comboExamtype.AddItem "2001期中"
comboExamtype.AddItem "2001期末"
myBookmark = mrc.Bookmark
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim MsgText As String
comboExamtype.Enabled = False
comboClassno.Enabled = False
comboSID.Enabled = False
comboCourse.Enabled = False
txtName.Enabled = False
txtResult.Enabled = False
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
editCommand.Enabled = True
updateCommand.Enabled = False
cancelCommand.Enabled = False
deleteCommand.Enabled = True
txtSQL = "select * from result_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
mrc.MoveFirst
Call viewData
myBookmark = mrc.Bookmark
End If
End Sub
Public Sub viewData()
comboExamtype.Text = mrc!exam_No
comboClassno.Text = mrc!class_No
comboSID.Text = mrc!student_ID
comboCourse.Text = mrc!course_Name
txtName.Text = mrc!student_Name
txtResult.Text = mrc!result
End Sub
Private Sub firstCommand_Click()
mrc.MoveFirst
Call viewData
End Sub
Private Sub lastCommand_Click()
mrc.MoveLast
Call viewData
End Sub
Private Sub nextCommand_Click()
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
End If
Call viewData
End Sub
Private Sub previousCommand_Click()
mrc.MovePrevious
If mrc.BOF Then
mrc.MoveLast
End If
Call viewData
End Sub
Private Sub updateCommand_Click()
Dim MsgText As String
Dim mrcc As ADODB.Recordset
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
' mrc.Delete
' 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, "警告"
comboExamtype.Clear
comboClassno.Clear
comboSID.Clear
comboCourse.Clear
txtSQL = "select * from result_Info"
Set mrc = ExecuteSQL(txtSQL, MsgText)
' mrc.MoveLast
Call viewData
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
editCommand.Enabled = True
updateCommand.Enabled = False
cancelCommand.Enabled = False
deleteCommand.Enabled = True
comboExamtype.Enabled = False
comboClassno.Enabled = False
comboSID.Enabled = False
comboCourse.Enabled = False
txtName.Enabled = False
txtResult.Enabled = False
End Sub
Private Sub comboClassno_Click()
Dim mrcc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
comboSID.Clear
txtSQL = "select * from student_Info where class_NO = '" & comboClassno.Text & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
While (mrcc.EOF = False)
comboSID.AddItem mrcc!student_ID
mrcc.MoveNext
Wend
mrcc.Close
txtSQL = "select * from class_Info where class_No = '" & comboClassno.Text & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
Grade = mrcc!Grade
mrcc.Close
comboCourse.Clear
txtSQL = "select * from gradecourse_Info where grade = '" & Grade & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
While (mrcc.EOF = False)
comboCourse.AddItem mrcc!course_Name
mrcc.MoveNext
Wend
mrcc.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -