在SSTab中创建了一个MSFlexgrid,连接数据库后发现MSFlexgrid中无法显示数据。确认数据库已经连接,而且在普通窗体上的MSFlexgrid可以正常显示数据.附代码如下:With MSFlexGrid1
.Visible = False
.Rows = 1
ProgressBar1.Value = .Rows
Do While Not Mar.EOF
.Rows = .Rows + 1
For i = 0 To Mar.Fields.Count - 2
.ColAlignment(i) = 4
.CellAlignment = 4
Select Case Mar.Fields(i).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(Mar.Fields(i + 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = Mar.Fields(i + 1) & ""
End Select
Next i
Mar.MoveNext
Loop
.Visible = True
End With
.Visible = False
.Rows = 1
ProgressBar1.Value = .Rows
Do While Not Mar.EOF
.Rows = .Rows + 1
For i = 0 To Mar.Fields.Count - 2
.ColAlignment(i) = 4
.CellAlignment = 4
Select Case Mar.Fields(i).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(Mar.Fields(i + 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = Mar.Fields(i + 1) & ""
End Select
Next i
Mar.MoveNext
Loop
.Visible = True
End With
mar.open ...
set msflexgrid1.datasource=mar
mar.close