机房之一般用户查询余额

流程图
机房之一般用户查询余额
代码实现

Private Sub cmdinquery_Click()
    Dim mrc As ADODB.Recordset
    Dim txtsql As String
    Dim msgtext As String
    
    '卡号输入不能为空
    If testtxt(txtcardno.Text) = False Then
        MsgBox "请输入卡号!", 0 + 48, 提示
        txtcardno.SetFocus
        Exit Sub
    End If

    '根据卡号查询学号和余额
    txtsql = "select * from card_info where cardno='" & Trim(txtcardno.Text) & "'"
    Set mrc = ExecuteSQL(txtsql, msgtext)
    '判断卡号是否已经注册
    If mrc.EOF = False And mrc.BOF = False Then
        '判断该卡是否已经退卡
        txtsql = "select * from cancelcard_info where cardno='" & Trim(txtcardno.Text) & "'"
        Set mrc = ExecuteSQL(txtsql, msgtext)
        If mrc.EOF = True And mrc.BOF = True Then
            txtsql = "select * from card_info where cardno='" & Trim(txtcardno.Text) & "'"
            Set mrc = ExecuteSQL(txtsql, msgtext)
            '将学号和余额显示在文本框中
            txtsno.Text = mrc.Fields(9)
            txtbalance.Text = mrc.Fields(3)
            txtstatus.Text = mrc.Fields(5)
            '根据学号查询学生信息
            txtsql = "select * from student_info where studentno='" & Trim(txtsno.Text) & "'"
            Set mrc = ExecuteSQL(txtsql, msgtext)
            '将查询结果显示在文本框中
            txtname.Text = mrc.Fields(1)
            txtsex.Text = mrc.Fields(2)
            txtdepartment.Text = mrc.Fields(3)
            txtgrade.Text = mrc.Fields(4)
            txtclass.Text = mrc.Fields(5)
            txtcomment.Text = mrc.Fields(6)
        Else
            MsgBox "此卡已经退卡,查询不到余额信息!", 0 + 48, 提示
            Exit Sub
        End If
    Else
        MsgBox "此卡号不存在!", 0 + 48, 提示
        Exit Sub
    End If

End Sub
上一篇:[PHP] php使用curl_multi_exec并行同时执行http请求


下一篇:机房收费系统---------结账