Re: What to use for ADO parameter type and size
- From: "RB Smissaert" <bartsmissaert@xxxxxxxxxxxxxxxx>
- Date: Fri, 27 Jul 2007 18:32:13 +0100
If EOF had been true, then you have just overwritten etc...
Will have a look at it, but I am nearly sure it is all fine.
Actually, why aren't you using Ubound(arr,2) - 1 to give you your record count? etc ...
We are dealing here with the cRecordset of the dhSQLite wrapper and this is all a
bit different. Will have a look though.
And I've just tested and found that a single value does indeed work fine
Thanks for clearing that up.
RBS
"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message news:OZAinKH0HHA.1212@xxxxxxxxxxxxxxxxxxxxxxx
RB Smissaert wrote:This is my function that returns the 2-D variant array:
Function GetFromDB(strSQL As String, _
Optional lReturnedRows As Long, _
Optional strError As String, _
Optional strDB As String, _
Optional bLogSQL As Boolean, _
Optional bIncludeHeaders As Boolean) As Variant
Dim cRS As cRecordset
Dim arr
10 On Error GoTo ERROROUT
20 OpenDB strDB
30 If bLogSQL Then
40 ShowStatement strSQL, , , 2, True, True, strDB
50 End If
60 Set cRS = Cnn.OpenRecordset(strSQL, True)
70 If cRS.EOF Then
80 lReturnedRows = -1
90 strError = Cnn.LastDBError
100 GetFromDB = strError
110 Else
120 If bIncludeHeaders Then
130 arr = cRS.GetRowsWithHeaders(, , , True)
140 Else
150 arr = cRS.GetRows(, , , True)
160 End If
170 lReturnedRows = cRS.RecordCount
If EOF had been true, then you have just overwritten the -1 in lReturnedRows ... You should have put an Exit Function statement before the Else statement above.
Actually, why aren't you using Ubound(arr,2) - 1 to give you your record count? That would eliminate needing to use RecordCount, allowing you to use the default, fast, server-side forwardonly cursor. Given your "need for speed" i would expect this to be something you would want to do.
This works with the SQLite wrapper dll dhSQLite written by Olaf
Schmidt. As far as I can see arr2(i,0) does not refer to a variant array but
to a single value.
And I've just tested and found that a single value does indeed work fine. So my puzzlement is ended
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- References:
- What to use for ADO parameter type and size
- From: RB Smissaert
- Re: What to use for ADO parameter type and size
- From: Bob Barrows [MVP]
- Re: What to use for ADO parameter type and size
- From: RB Smissaert
- Re: What to use for ADO parameter type and size
- From: Bob Barrows [MVP]
- Re: What to use for ADO parameter type and size
- From: RB Smissaert
- Re: What to use for ADO parameter type and size
- From: Bob Barrows [MVP]
- Re: What to use for ADO parameter type and size
- From: RB Smissaert
- Re: What to use for ADO parameter type and size
- From: Bob Barrows [MVP]
- What to use for ADO parameter type and size
- Prev by Date: Re: What to use for ADO parameter type and size
- Next by Date: Re: What to use for ADO parameter type and size
- Previous by thread: Re: What to use for ADO parameter type and size
- Next by thread: Re: What to use for ADO parameter type and size
- Index(es):