学生信息管理系统之查:查询成绩信息流程

查询成绩信息流程图:

这里写图片描述

查询成绩信息代码部分

一、myflesgrid数据加载

 With myflexgrid
        .CellAlignment = 4           '对齐方式中中对齐
        .TextMatrix(1, 0) = "考试编号"
        .TextMatrix(1, 1) = "学号"
        .TextMatrix(1, 2) = "姓名"
        .TextMatrix(1, 3) = "班号"
        .TextMatrix(1, 4) = "课程名称"
        .TextMatrix(1, 5) = "分数"
    End With

二、检测查询方式

txtSQL = "select * from result_Info where "
    If Check1(0).Value Then
    ......
    End If

    If Check1(1).Value Then
    ......
    End If

     If Check1(2).Value Then
    ......
    End If

三、判断文本框是否为空,是否为数字

If Trim(txtSID.Text) = "" Then
            sMeg = "学号不能为空"
            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
            txtSID.SetFocus
            Exit Sub
        Else
            If Not IsNumeric(Trim(txtSID.Text)) Then
                MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
                Exit Sub
                txtSID.SetFocus
            End If
            dd(0) = True
            txtSQL = txtSQL & "student_ID='" & Trim(txtSID.Text) & "'"
        End If

四、各查询方式的叠加

Dim dd(4) As Boolean
    If Check1(0).Value Then
        If ...
        Else...
            dd(0) = True
            txtSQL = txtSQL & "student_ID='" & Trim(txtSID.Text) & "'"
        End If
    End If

    If Check1(1).Value Then
        If...
        Else...
            dd(1) = True
            If dd(0) Then
                txtSQL = txtSQL & "and student_Name='" & txtName.Text & "'"
            Else
                txtSQL = txtSQL & "student_Name='" & txtName.Text & "'"
            End If
        End If
    End If

    If Check1(2).Value Then
        If ...
        Else
            dd(2) = True
            If dd(0) Or dd(1) Then
                txtSQL = txtSQL & "and course_Name='" & txtCourse.Text & "'"
            Else
                txtSQL = txtSQL & "course_Name='" & txtCourse.Text & "'"
            End If
        End If
    End If

    If Not (dd(0) Or dd(1) Or dd(2) Or dd(3)) Then
        MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    End If

查询成绩信息窗体的特点:多项选择的查询。

这就涉及到了多项查询数据库内多个内容的衔接,它的逻辑是我们要着重梳理的。

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 10
    评论
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Elsa~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值