机房之一般用户查询充值记录

实现思路
我的一般用户登录即上机(用卡号登录上机),所以也只能查看自己的充值记录,用lable框自动显示当前登录的卡号
在一般用户注册的时候,充值的金额也添加到充值表当中,所以每次查询必定最少有一条记录(即第一次注册时的充值金额)

界面如下
在这里插入图片描述

流程图

在这里插入图片描述
代码实现

Private Sub Form_Load()
    '设置窗体的位置和大小
    Me.Left = 0
    Me.Top = 700
    Me.Height = 16000
    Me.Width = 18000

    '显示当前卡号
    lblcardno.Caption = "卡号:" & username
    
    Dim mrc As adodb.Recordset
    Dim txtsql, msgtext As String

     '查看recharge_info表
     txtsql = "select * from recharge_info where cardno='" & username & "'"
     Set mrc = ExecuteSQL(txtsql, msgtext)

     With MSFlexGrid1
         .Rows = 1
         .Cols = 4
         '设置各列的对齐方式为居中
         For i = 0 To .Cols - 1
            .ColAlignment(i) = 4
         Next i
         .TextMatrix(0, 0) = "卡号"
         .TextMatrix(0, 1) = "充值金额"
         .TextMatrix(0, 2) = "充值时间"
         .TextMatrix(0, 3) = "充值人员"
         '设置列的固定宽度
         .ColWidth(2) = 5000
         If mrc.EOF = False And mrc.BOF = False Then
            Do While Not mrc.EOF
             .Rows = .Rows + 1
             .TextMatrix(.Rows - 1, 0) = mrc!cardno
             .TextMatrix(.Rows - 1, 1) = mrc!addmoney
             .TextMatrix(.Rows - 1, 2) = mrc!DateTime
             .TextMatrix(.Rows - 1, 3) = mrc!UserID
             mrc.MoveNext
            Loop
        End If
     End With
End Sub



发布了45 篇原创文章 · 获赞 10 · 访问量 6201

猜你喜欢

转载自blog.csdn.net/wtt15100/article/details/100554881