学生信息管理系统总结(优化二)

学生信息管理系统无时无刻不在进行优化,接下来继续给大家分享我对学生信息管理系统的优化,希望对大家有所帮助哦。

一、显示当前数据位置

Private Sub nextCommand_Click()
    If mrc.EOF = True Then
        MsgBox "已经是最后一条数据"
    Else
         mrc.MoveNext
    End If
    Call viewData
End Sub

Private Sub previousCommand_Click()
    If mrc.BOF = True Then
        MsgBox "已经是第一条数据"
    Else
         mrc.MovePrevious
    End If
    Call viewData
End Sub

二、判断输入的分数

Private Sub txtResult_Change()
    If Val(txtResult.Text) > 150 Then
        MsgBox "成绩已超出范围,成绩范围为0~150哦"
        txtResult.SetFocus
        txtResult.Text = ""
    End If
End Sub

三、修改密码前输入旧密码

txtSQL = "select * from user_Info where user_ID ='" & UserName & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If (Userpwd = Text2.Text) Then
      MsgBox "请输入正确的旧密码!"
      Text2.Text = ""
end if

四、新密码和旧密码是否一致

txtSQL = "select * from user_Info where user_ID ='" & UserName & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If (Userpwd = Text1(1).Text) Then
    MsgBox "与旧密码重复,请重新修改!"
    Text1(1).Text = ""
    Text1(2).Text = ""
    Text1(1).SetFocus
else
    mrc.Fields(1) = Text1(1).Text
    mrc.Update
    mrc.Close
    MsgBox "密码修改成功!", vbOKOnly + vbExclamation, "修改密码"
    Unload Me
End If

五、不重复添加课程

Static b  As Integer
Dim s As String
Dim w As Integer

If listAllcourse.ListIndex <> -1 Then
    For b = 0 To listSelectcourse.ListCount - 1
        If listSelectcourse.List(b) = listAllcourse.List(listAllcourse.ListIndex) Then
            MsgBox "不能重复添加课程!"
            w = 3
        End If
    Next
        If w = 3 Then
    Exit Sub
Else
    listSelectcourse.AddItem listAllcourse.List(listAllcourse.ListIndex)
End If
发布了17 篇原创文章 · 获赞 1 · 访问量 3848

猜你喜欢

转载自blog.csdn.net/weixin_45490198/article/details/100163210
今日推荐