Display all forms of the first computer room charging system

This is the form for displaying all, as long as you click the Reveal All button, the online data will be displayed in the table.

The code in this part is relatively simple, just connect to the Online table.

Code display:

Private Sub ShowAll_Click()
    Dim mrc As ADODB.Recordset '连接到online表
    Dim txtSQL As String
    Dim Msgtext As String
    
    txtSQL = "select * from Online_info"
    Set mrc = ExecuteSQL(txtSQL, Msgtext)
    If mrc.EOF Then
        MsgBox "?????????", vbOKOnly + vbExclamation, "???"
    Else
        With MSHFlexGrid1
            Do While Not mrc.EOF
                .CellAlignment = 4
                
                .Rows = .Rows + 1'显示多行
                .TextMatrix(.Rows - 2, 0) = mrc.Fields(0)
                .TextMatrix(.Rows - 2, 1) = mrc.Fields(3)
                .TextMatrix(.Rows - 2, 2) = mrc.Fields(6)
                .TextMatrix(.Rows - 2, 3) = mrc.Fields(7)
                .TextMatrix(.Rows - 2, 4) = mrc.Fields(8)
                mrc.MoveNext
            Loop
        End With
    End If
    mrc.Close
End Sub

 

Guess you like

Origin blog.csdn.net/weixin_45309155/article/details/106310459