显示全部的窗体是这种,只要点击显现全部按钮就会把已在上线的数据显示到表格中。
这一部分的代码相对来说比较简单,只需要连接到Online 表即可
代码展示:
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