Este es el formulario para mostrar todo, siempre que haga clic en el botón Revelar todo, los datos en línea se mostrarán en la tabla.
El código en esta parte es relativamente simple, simplemente conéctese a la tabla en línea.
Visualización de código:
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