Sorting results in EOF/BOF for a manually created recordset 
Author Message
 Sorting results in EOF/BOF for a manually created recordset

I have manually created a recordset in VB6 using ADO 2.7 - appended some
adVarWChat type fields to it and then added some data.
I can navigate thru the data properly - but when I try to sort that
recordset (cursorlocation=aduseclient), it changes both eof and bof = true.
Here is the code: (for simplicity - its modified source code from original)
--------------
    Dim rsCopy As New ADODB.Recordset

    For i = 0 To j
        rsCopy.Fields.Append someName(j), adVarWChar, 65535, 32  '(max data
size in a field = 65535)
    Next

    rsCopy.CursorLocation = adUseClient ' a MUST for sorting a recordset
    rsCopy.Open

    for k = 0 to otherVar
        rsCopy.AddNew
        For i = 0 to j
              rsCopy(i).Value = dataSource(i,k)
        Next
        rsCopy.Update
    next
    rsCopy.MoveFirst

    rsCopy.Sort = "SomeFieldName"
--------------

TIA



Tue, 26 Oct 2004 06:00:49 GMT  
 Sorting results in EOF/BOF for a manually created recordset
I have already tried changing the datatype to adVarChar.
Also: if I set the sort property back to "" then i can see the data again.


Quote:
> I have manually created a recordset in VB6 using ADO 2.7 - appended some
> adVarWChat type fields to it and then added some data.
> I can navigate thru the data properly - but when I try to sort that
> recordset (cursorlocation=aduseclient), it changes both eof and bof =
true.
> Here is the code: (for simplicity - its modified source code from
original)
> --------------
>     Dim rsCopy As New ADODB.Recordset

>     For i = 0 To j
>         rsCopy.Fields.Append someName(j), adVarWChar, 65535, 32  '(max
data
> size in a field = 65535)
>     Next

>     rsCopy.CursorLocation = adUseClient ' a MUST for sorting a recordset
>     rsCopy.Open

>     for k = 0 to otherVar
>         rsCopy.AddNew
>         For i = 0 to j
>               rsCopy(i).Value = dataSource(i,k)
>         Next
>         rsCopy.Update
>     next
>     rsCopy.MoveFirst

>     rsCopy.Sort = "SomeFieldName"
> --------------

> TIA



Tue, 26 Oct 2004 06:10:27 GMT  
 Sorting results in EOF/BOF for a manually created recordset
Found a possible fix.

Replaced the field append line with:
rsCopy.Fields.Append someName(j), adLongVarChar, 57000, 32  (the defined
size limit for this type is b/w 57k to 58k ... plz correct if wrong)


Quote:
> I have already tried changing the datatype to adVarChar.
> Also: if I set the sort property back to "" then i can see the data again.



> > I have manually created a recordset in VB6 using ADO 2.7 - appended some
> > adVarWChat type fields to it and then added some data.
> > I can navigate thru the data properly - but when I try to sort that
> > recordset (cursorlocation=aduseclient), it changes both eof and bof =
> true.
> > Here is the code: (for simplicity - its modified source code from
> original)
> > --------------
> >     Dim rsCopy As New ADODB.Recordset

> >     For i = 0 To j
> >         rsCopy.Fields.Append someName(j), adVarWChar, 65535, 32  '(max
> data
> > size in a field = 65535)
> >     Next

> >     rsCopy.CursorLocation = adUseClient ' a MUST for sorting a recordset
> >     rsCopy.Open

> >     for k = 0 to otherVar
> >         rsCopy.AddNew
> >         For i = 0 to j
> >               rsCopy(i).Value = dataSource(i,k)
> >         Next
> >         rsCopy.Update
> >     next
> >     rsCopy.MoveFirst

> >     rsCopy.Sort = "SomeFieldName"
> > --------------

> > TIA



Tue, 26 Oct 2004 08:29:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. BOF/EOF Problem in Database Application (ADO Recordset)

2. Error 3021 ( recordset returns either EOF or BOF is TRUE)

3. Error 3021 ( recordset returns either EOF or BOF is TRUE)

4. MSHFlex.recordset = rs & EOF/BOF markers

5. Manually create a results set?

6. DAO--BOF and EOF vs recordcount = 0

7. (.EOF AND .BOF) = no records?

8. BOF/EOF in RecordsetClone

9. EOF and BOF

10. Error 3021 "Either EOF or BOF, record may be deleted

11. Browsing thru records without clicking error at BOF and EOF

12. 3021 Either BOF or EOF is true?

 

 
Powered by phpBB® Forum Software