VB+SQL server学生信息管理系统毕业论文附源代码 第19页
If Not Testtxt(comboCoursetype.Text) Then
MsgBox "请选择课程类型!", vbOKOnly + vbExclamation, "警告"
comboCoursetype.SetFocus
Exit Sub
End If
If Not Testtxt(txtCoursedes.Text) Then
MsgBox "请输入课程描述信息!", vbOKOnly + vbExclamation, "警告"
txtCoursedes.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(txtCourseno.Text)) Then
MsgBox "请输入数字编号!", vbOKOnly + vbExclamation, "警告"
Exit Sub
txtCourseno.SetFocus
End If
txtSQL = "select * from course_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
While (mrc.EOF = False)
If (Trim(mrc.Fields(0)) = Trim(txtCourseno.Text)) Then
MsgBox "课程编号已经存在,请重新输入课程编号!", vbOKOnly + vbExclamation, "警告"
txtCourseno.Text = ""
txtCourseno.SetFocus
Exit Sub
Else
mrc.MoveNext
End If
Wend
mrc.AddNew
mrc.Fields(0) = Trim(txtCourseno.Text)
mrc.Fields(1) = Trim(txtCoursename.Text)
mrc.Fields(2) = Trim(comboCoursetype.Text)
mrc.Fields(3) = Trim(txtCoursedes.Text)
mrc.Update
mrc.Close
MsgBox "添加课程信息成功!", vbOKOnly + vbExclamation, "添加课程信息"
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
comboCoursetype.AddItem "必修"
comboCoursetype.AddItem "考查"
End Sub
.........................................................................................................
.............................. frmAddresult 添加成绩信息窗口代码 .................................
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
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>