- Home
·
- OLE/COM/DCOM/Active-X
·
- Populates the MSFlexGrid control with data from ADODB recordset. Input Parameter : ADODB recordset.
Populates the MSFlexGrid control with data from ADODB recordset. Input Parameter : ADODB recordset.
Populates the MSFlexGrid control with data from ADODB recordset. Input Parameter : ADODB recordset. Replace "grdResults" in the code with your
Rate Populates the MSFlexGrid control with data from ADODB recordset. Input Parameter : ADODB recordset.
(2(2 Vote))
Dim liColNum As Integer
Dim liNumOfCols As Integer
Dim liRowNum As Integer
Dim liNumOfRows As Integer
Dim lsRowVal As String
Dim lsBoolVal As String
' ---- Initialize column number
liColNum = 1
' ---- Initialize grid
grdResults.Clear
grdResults.Col = 0
grdResults.Row = 0
' ---- Get # of Columns
grdResults.Cols = lsResultSet.Fields.Count + 1
' ---- Move pointer to first record
If Not lsResultSet.BOF Then
lsResultSet.MoveFirst
End If
' ---- Get # of Rows
Do Until lsResultSet.EOF
liNumOfRows = liNumOfRows + 1
lsResultSet.MoveNext
Loop
' ---- Fill the headers first
For Each gsFldSet In lsResultSet.Fields
grdResults.Col = liColNum
liColNum = liColNum + 1
grdResults.Text = gsFldSet.Name
Next
' ---- Move pointer to first record
If Not lsResultSet.BOF Then
lsResultSet.MoveFirst
End If
liRowNum = 0
' ---- Total # of rows one more than actual #
grdResults.Rows = liNumOfRows + 1
' ---- Populate grid with table data
Do While Not lsResultSet.EOF
liColNum = 0
liRowNum = liRowNum + 1
For Each gsFldSet In lsResultSet.Fields
liColNum = liColNum + 1
grdResults.Col = liColNum
grdResults.Row = liRowNum
If gsFldSet.Value = "" Then
grdResults.Text = "NULL"
ElseIf gsFldSet.Type = adBoolean Then
lsBoolVal = gsFldSet.Value
If lsBoolVal = "True" Then
grdResults.Text = "1"
Else
grdResults.Text = "0"
End If
Else
grdResults.Text = gsFldSet.Value
End If
Next
lsResultSet.MoveNext
Loop
End Function
Populates the MSFlexGrid control with data from ADODB recordset. Input Parameter : ADODB recordset. Comments
No comments yet — be the first to post one!
Post a Comment