| | |
Determining the size of a recordset
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hello Everyone,
I am having some trouble with a VBA application I am writing for work. I am using ADODB to connect to an Oracle database and return and I want to return a 2-D array from my function. The problem I am having seems to be determining how big the recordset is so that I can ReDim my 2-D array to fit the results. Any help would be greatly appreciated. I have included the function below.
Thanks,
Nick
I am having some trouble with a VBA application I am writing for work. I am using ADODB to connect to an Oracle database and return and I want to return a 2-D array from my function. The problem I am having seems to be determining how big the recordset is so that I can ReDim my 2-D array to fit the results. Any help would be greatly appreciated. I have included the function below.
Thanks,
Nick
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Public Function QueryArray(QueryString As String) As String() Dim RowCount As Integer Dim ResultArray() As String Dim i As Integer RowCount = 0 rsOra.Open QueryString, cnOra, adOpenForwardOnly ReDim ResultArray(0 To 100, 0 To 100) ' THIS IS WHERE I AM HAVING THE PROBLEM While Not rsOra.EOF For i = 0 To rsOra.Fields.Count - 1 If IsNull(rsOra.Fields(i)) Then ResultArray(RowCount, i) = "" Else ResultArray(RowCount, i) = rsOra.Fields(i) End If Next RowCount = RowCount + 1 rsOra.MoveNext Wend If IsArrayEmpty(ResultArray) Then Exit Function Else QueryArray = ResultArray End If End Function
![]() |
Similar Threads
- Vb6 Data Report Repeatedly Shows Previous Report (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Executing Query with criteria at run time
- Next Thread: Guys please help me
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





