We use ADO to get a RS from a STORED PROCEDURE in MS SQL SERVER 2000.
This is a loop we use to build a FLEX GRID from that RECORDSET.
I did a lot of cut/paste to put this together - hope it still runs (it came from a much bigger routine).
Code:For z = 0 To rsInquire.Fields.Count - 1 ' Lets look at our column headings first strEle = rsInquire.Fields(z).Name ' Column heading Select Case rsInquire.Fields(z).Type ' Deal with data type and column size Case adTinyInt lngSize = 4 Case adUnsignedTinyInt lngSize = 4 Case adInteger lngSize = 12 Case adUnsignedInt lngSize = 12 Case adCurrency lngSize = 13 Case Else lngSize = rsInquire.Fields(z).DefinedSize End Select With flxInput(lngGrid) ' Build the heading format string If .FormatString <> "" Then .FormatString = .FormatString & "|" If Left(strEle, 1) <> "^" And Left(strEle, 1) <> ">" Then strEle = "<" & strEle .FormatString = .FormatString & strEle .ColData(.Cols - 1) = lngSize End With Next z Do While rsInquire.EOF = False ' Loop through the recordset now lngRecCnt = lngRecCnt + 1 For z = 0 To rsInquire.Fields.Count - 1 strWhat = rsInquire(z) & "" ' The data element for this row/column If strGridLine <> "" Then strGridLine = strGridLine & vbTab strGridLine = strGridLine & strWhat Next z flxInput(lngGrid).AddItem strGridLine strGridLine = "" rsInquire.MoveNext Loop




Reply With Quote