我正在使用 VB6 从 SQL Server 导入数据并将其显示在网格中。网格有 100 行,当我尝试在网格的单行中填充数据库中的单行时,它会在网格中重复 100 次,但我只希望它保持在单行中。我究竟做错了什么?
代码:
While Count < 100
Dim adoCSRS As adodb.Recordset
Set adoCSRS = New adodb.Recordset
adoCSRS.CursorLocation = adUseClient
'Then comes my query which has no problem as the data is being retrieved without any problem and then'
Dim i As Integer
While Not adoCSRS.EOF
'After this part, I assign the text fields their respective values from Database and then'
i = i + 1
MSFlexGrid.AddItem _
adoCSRS.Fields("Coulmn Name") & Chr(9) & _
adoCSRS.Fields("Coulmn Name") & Chr(9) & _
adoCSRS.Fields("Coulmn Name") & Chr(9) & _
adoCSRS.Fields("Coulmn Name") & Chr(9) & _
adoCSRS.Fields("Coulmn Name") & Chr(9) & _
adoCSRS.Fields("Coulmn Name") & Chr(9) & _
adoCSRS.Fields("Coulmn Name") & Chr(9)
MSFlexGrid.Col = 11
MSFlexGrid.Row = i
MSFlexGrid.CellFontName = "Wingdings"
MSFlexGrid.CellFontSize = 10
MSFlexGrid.CellAlignment = flexAlignCenterCenter
MSFlexGrid.TextMatrix(i, 14) = uncheckedBox
adoCSRS.MoveNext
Wend
MSFlexGrid.RowSel = 0
successful = True
Count = Count + 1
Wend