Sort order cannot be applied - SOLUTION

Sort order cannot be applied - SOLUTION

Post by John Hal » Fri, 09 Nov 2001 14:35:13



I have just spent two hours trying to sort a disconnected recordset.
Filter works fine. Sort sez: Sort order cannot be applied.

Searched the Web  - many people with the problem, none with a fix.
Got suspicious when one guy said he could sort an Integer field but not
String.
Searched Groups Google - same.
Showed the Groups "similar messages suppressed" thinggy, and

FOUND THE ANSWER!. In a Borland Delphi newsgroup!
In : borland.public.delphi.database.ado on: 2001-08-07

You are trying to sort on a column of a Variant type which is obviously not
possible. Try this:

NewRecordSet.Fields.Append('Surname', adVarChar, 100, adFldUpdatable);
NewRecordSet.Fields.Append('FirstName', adVarChar, 100, adFldUpdatable);

WOW!. Changed my adBSTR to adVarChar AND IT SORTS

NB
Const adVarChar = 200

Many thanks to Vassil!

 
 
 

Sort order cannot be applied - SOLUTION

Post by Val Mazu » Fri, 09 Nov 2001 22:19:18


Hi,

Also there is one more limitation. You cannot sort and
filter on binary and text data type fields.

Val

>-----Original Message-----
>I have just spent two hours trying to sort a disconnected
recordset.
>Filter works fine. Sort sez: Sort order cannot be applied.

>Searched the Web  - many people with the problem, none
with a fix.
>Got suspicious when one guy said he could sort an Integer
field but not
>String.
>Searched Groups Google - same.
>Showed the Groups "similar messages suppressed" thinggy,
and

>FOUND THE ANSWER!. In a Borland Delphi newsgroup!
>In : borland.public.delphi.database.ado on: 2001-08-07

>You are trying to sort on a column of a Variant type

which is obviously not

- Show quoted text -

Quote:>possible. Try this:

>NewRecordSet.Fields.Append('Surname', adVarChar, 100,
adFldUpdatable);
>NewRecordSet.Fields.Append('FirstName', adVarChar, 100,
adFldUpdatable);

>WOW!. Changed my adBSTR to adVarChar AND IT SORTS

>NB
>Const adVarChar = 200

>Many thanks to Vassil!

>.


 
 
 

1. Sort order cannot be applied (80040e60)

Hi,

I am working on a project which does not use a Database as backend. Instead
it uses a Disconnected Recordset to store and Manipulate Data.

With rs
    Set .ActiveConnection = Nothing
    .CursorLocation = adUseClient
    .LockType = adLockBatchOptimistic

    With .Fields
        .Append "MDate", adDBDate
        .Append "From", adBSTR
        .Append "To", adBSTR
        .Append "TotalCount", adInteger
    End With
End With

After Necessary Processing the data is saved in XML Format.

rs.save App.Path & "\Data.xml"

But before saving i need to generate a report. I am trying to do this by

Set rs2 = New ADODB.Recordset
rs2.CursorLocation = adUseClient

rs.Filter = "mdate >= '" & dtpFrom.Value & "' and mdate <='" & dtpTo.Value &
"'"
Set rs2 = rs
rs2.Sort = "MDate,from"
rs.Filter = adFilterNone

But each time i try to generate the report it produces an error:
    -2147217824 (80040e60)
    Sort order cannot be applied

Can anyone Please help me out.

Regards,
Sanjeev K. B

2. CASCADE changes to foreign key?

3. Dynamic SQL versus building query on client

4. Error: Sort Order Cannot Be Applied

5. Need add/edit/delete component!

6. Converting a database from dictionary case insensitive sort order to binary sort order

7. Ingres/Net on 6.4

8. Oracle sort order on HP-UX versur Windows sort order