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
如何防止显示全部上机学生时重复
在做机房收费系统查看学生上机状态中,显示全部信息时,发现会出现重复的卡号,后来查了又查,改了又改,加了个简单的循环,便避免了这种情况