如何防止显示全部上机学生时重复

在做机房收费系统查看学生上机状态中,显示全部信息时,发现会出现重复的卡号,后来查了又查,改了又改,加了个简单的循环,便避免了这种情况
Private Sub showAll_Click()
    Dim txtsqlOn As String
    Dim msgtext As String
    Dim mrcOn As ADODB.Recordset
    Dim i As Integer
    Dim j As Integer
    txtsqlOn = "select * from online_info"
    Set mrcOn = executeSQL(txtsqlOn, msgtext)
    
    With myFlexGrid
        .CellAlignment = 4
        .Rows = 1
        .TextMatrix(0, 0) = "卡号"
        .TextMatrix(0, 1) = "姓名"
        .TextMatrix(0, 2) = "上机日期"
        .TextMatrix(0, 3) = "上机时间"
        .TextMatrix(0, 4) = "机房号"
        Do While Not mrcOn.EOF
            .CellAlignment = 4
            .Rows = .Rows + 1
            .TextMatrix(.Rows - 1, 0) = mrcOn!cardno
            .TextMatrix(.Rows - 1, 1) = mrcOn!studentname
            .TextMatrix(.Rows - 1, 2) = mrcOn!ondate
            .TextMatrix(.Rows - 1, 3) = mrcOn!OnTime
            .TextMatrix(.Rows - 1, 4) = mrcOn!computer
            mrcOn.MoveNext
            For i = 0 To .TextMatrix(.Rows - 1, 0)
          '  .Rows = .Rows + 1
                For j = j + 1 To Val(Trim(.TextMatrix(.Rows - 1, 0)))
                If .TextMatrix(i, 0) = .TextMatrix(j, 0) Then
                    .RemoveItem j
                    Exit Sub
                Else
                
                End If
            Next j
        Next i
        Loop
    End With
End Sub

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值