Error: Sort Order Cannot Be Applied

Error: Sort Order Cannot Be Applied

Post by Brian Lytl » Thu, 19 Sep 2002 00:07:50



I am using the following code (I have also attached my XML
file) to try to load a RS from an XML file and sort it.  I
know I could just sort the XML file, but I have my reasons
for wanting to di it via ADO.  I keep getting a Sort Order
Cannot Be Applied error.  Any ideas?

Dim rsXmlData
Dim oStream

Set rsXmlData = Server.CreateObject("ADODB.Recordset")
Set oStream = Server.CreateObject("ADODB.Stream")

oStream.Open
oStream.Charset = "UTF-8"
oStream.LoadFromFile Server.MapPath
("../xml/ACCT_LIST_SM.xml")
oStream.Position = 0

rsXmlData.CursorLocation = adUseClient
rsXmlData.CursorType = adOpenStatic
rsXmlData.LockType = adLockBatchOptimistic
rsXmlData.Open oStream

rsXmlData.Sort = "pre_petition DESC"

  ACCT_LIST_SM.xml
2K Download
 
 
 

Error: Sort Order Cannot Be Applied

Post by Val Mazu » Thu, 19 Sep 2002 00:57:36


Hi,

What is the data type of pre_petition field? In case if it is BLOB type of
field, you cannot use Sort

--
Val Mazur
Microsoft MVP


Quote:> I am using the following code (I have also attached my XML
> file) to try to load a RS from an XML file and sort it.  I
> know I could just sort the XML file, but I have my reasons
> for wanting to di it via ADO.  I keep getting a Sort Order
> Cannot Be Applied error.  Any ideas?

> Dim rsXmlData
> Dim oStream

> Set rsXmlData = Server.CreateObject("ADODB.Recordset")
> Set oStream = Server.CreateObject("ADODB.Stream")

> oStream.Open
> oStream.Charset = "UTF-8"
> oStream.LoadFromFile Server.MapPath
> ("../xml/ACCT_LIST_SM.xml")
> oStream.Position = 0

> rsXmlData.CursorLocation = adUseClient
> rsXmlData.CursorType = adOpenStatic
> rsXmlData.LockType = adLockBatchOptimistic
> rsXmlData.Open oStream

> rsXmlData.Sort = "pre_petition DESC"


 
 
 

Error: Sort Order Cannot Be Applied

Post by Val Mazu » Thu, 19 Sep 2002 02:39:22


Is it same integer in recordset? Check Type property of then field.

--
Val Mazur
Microsoft MVP


> It is defined as an integer in the XML file

> >-----Original Message-----
> >Hi,

> >What is the data type of pre_petition field? In case if
> it is BLOB type of
> >field, you cannot use Sort

> >--
> >Val Mazur
> >Microsoft MVP



> >> I am using the following code (I have also attached my
> XML
> >> file) to try to load a RS from an XML file and sort
> it.  I
> >> know I could just sort the XML file, but I have my
> reasons
> >> for wanting to di it via ADO.  I keep getting a Sort
> Order
> >> Cannot Be Applied error.  Any ideas?

> >> Dim rsXmlData
> >> Dim oStream

> >> Set rsXmlData = Server.CreateObject("ADODB.Recordset")
> >> Set oStream = Server.CreateObject("ADODB.Stream")

> >> oStream.Open
> >> oStream.Charset = "UTF-8"
> >> oStream.LoadFromFile Server.MapPath
> >> ("../xml/ACCT_LIST_SM.xml")
> >> oStream.Position = 0

> >> rsXmlData.CursorLocation = adUseClient
> >> rsXmlData.CursorType = adOpenStatic
> >> rsXmlData.LockType = adLockBatchOptimistic
> >> rsXmlData.Open oStream

> >> rsXmlData.Sort = "pre_petition DESC"

> >.

 
 
 

Error: Sort Order Cannot Be Applied

Post by Brian Lytl » Thu, 19 Sep 2002 03:38:35


I got it!!!  Thanks for your help.  My XML file schema was
just not descriptive enough.

- Brian

>-----Original Message-----

>Good call.  It is not an Integer in the RS.  It is a
>adLongVarWChar.  I am not familiar with that data type.  
>Is it sortable?  Evidently not! :-)

>Do you know why it is changing?

>- Brian

>>-----Original Message-----
>>Is it same integer in recordset? Check Type property of
>then field.

>>--
>>Val Mazur
>>Microsoft MVP



>>> It is defined as an integer in the XML file

>>> >-----Original Message-----
>>> >Hi,

>>> >What is the data type of pre_petition field? In case
if
>>> it is BLOB type of
>>> >field, you cannot use Sort

>>> >--
>>> >Val Mazur
>>> >Microsoft MVP


>message

>>> >> I am using the following code (I have also attached
>my
>>> XML
>>> >> file) to try to load a RS from an XML file and sort
>>> it.  I
>>> >> know I could just sort the XML file, but I have my
>>> reasons
>>> >> for wanting to di it via ADO.  I keep getting a Sort
>>> Order
>>> >> Cannot Be Applied error.  Any ideas?

>>> >> Dim rsXmlData
>>> >> Dim oStream

>>> >> Set rsXmlData = Server.CreateObject
>("ADODB.Recordset")
>>> >> Set oStream = Server.CreateObject("ADODB.Stream")

>>> >> oStream.Open
>>> >> oStream.Charset = "UTF-8"
>>> >> oStream.LoadFromFile Server.MapPath
>>> >> ("../xml/ACCT_LIST_SM.xml")
>>> >> oStream.Position = 0

>>> >> rsXmlData.CursorLocation = adUseClient
>>> >> rsXmlData.CursorType = adOpenStatic
>>> >> rsXmlData.LockType = adLockBatchOptimistic
>>> >> rsXmlData.Open oStream

>>> >> rsXmlData.Sort = "pre_petition DESC"

>>> >.

>>.

>.

 
 
 

Error: Sort Order Cannot Be Applied

Post by Val Mazu » Thu, 19 Sep 2002 03:49:35


Actually adLongVarWChar is not sortable, because it belongs to BLOB data
type

--
Val Mazur
Microsoft MVP

> I got it!!!  Thanks for your help.  My XML file schema was
> just not descriptive enough.

> - Brian

> >-----Original Message-----

> >Good call.  It is not an Integer in the RS.  It is a
> >adLongVarWChar.  I am not familiar with that data type.
> >Is it sortable?  Evidently not! :-)

> >Do you know why it is changing?

> >- Brian

> >>-----Original Message-----
> >>Is it same integer in recordset? Check Type property of
> >then field.

> >>--
> >>Val Mazur
> >>Microsoft MVP



> >>> It is defined as an integer in the XML file

> >>> >-----Original Message-----
> >>> >Hi,

> >>> >What is the data type of pre_petition field? In case
> if
> >>> it is BLOB type of
> >>> >field, you cannot use Sort

> >>> >--
> >>> >Val Mazur
> >>> >Microsoft MVP


> >message

> >>> >> I am using the following code (I have also attached
> >my
> >>> XML
> >>> >> file) to try to load a RS from an XML file and sort
> >>> it.  I
> >>> >> know I could just sort the XML file, but I have my
> >>> reasons
> >>> >> for wanting to di it via ADO.  I keep getting a Sort
> >>> Order
> >>> >> Cannot Be Applied error.  Any ideas?

> >>> >> Dim rsXmlData
> >>> >> Dim oStream

> >>> >> Set rsXmlData = Server.CreateObject
> >("ADODB.Recordset")
> >>> >> Set oStream = Server.CreateObject("ADODB.Stream")

> >>> >> oStream.Open
> >>> >> oStream.Charset = "UTF-8"
> >>> >> oStream.LoadFromFile Server.MapPath
> >>> >> ("../xml/ACCT_LIST_SM.xml")
> >>> >> oStream.Position = 0

> >>> >> rsXmlData.CursorLocation = adUseClient
> >>> >> rsXmlData.CursorType = adOpenStatic
> >>> >> rsXmlData.LockType = adLockBatchOptimistic
> >>> >> rsXmlData.Open oStream

> >>> >> rsXmlData.Sort = "pre_petition DESC"

> >>> >.

> >>.

> >.

 
 
 

Error: Sort Order Cannot Be Applied

Post by Brian Lytl » Thu, 19 Sep 2002 02:14:33


It is defined as an integer in the XML file

>-----Original Message-----
>Hi,

>What is the data type of pre_petition field? In case if
it is BLOB type of
>field, you cannot use Sort

>--
>Val Mazur
>Microsoft MVP



>> I am using the following code (I have also attached my
XML
>> file) to try to load a RS from an XML file and sort
it.  I
>> know I could just sort the XML file, but I have my
reasons
>> for wanting to di it via ADO.  I keep getting a Sort
Order
>> Cannot Be Applied error.  Any ideas?

>> Dim rsXmlData
>> Dim oStream

>> Set rsXmlData = Server.CreateObject("ADODB.Recordset")
>> Set oStream = Server.CreateObject("ADODB.Stream")

>> oStream.Open
>> oStream.Charset = "UTF-8"
>> oStream.LoadFromFile Server.MapPath
>> ("../xml/ACCT_LIST_SM.xml")
>> oStream.Position = 0

>> rsXmlData.CursorLocation = adUseClient
>> rsXmlData.CursorType = adOpenStatic
>> rsXmlData.LockType = adLockBatchOptimistic
>> rsXmlData.Open oStream

>> rsXmlData.Sort = "pre_petition DESC"

>.

 
 
 

Error: Sort Order Cannot Be Applied

Post by Brian Lytl » Thu, 19 Sep 2002 03:03:14


Good call.  It is not an Integer in the RS.  It is a
adLongVarWChar.  I am not familiar with that data type.  
Is it sortable?  Evidently not! :-)

Do you know why it is changing?

- Brian

>-----Original Message-----
>Is it same integer in recordset? Check Type property of
then field.

>--
>Val Mazur
>Microsoft MVP



>> It is defined as an integer in the XML file

>> >-----Original Message-----
>> >Hi,

>> >What is the data type of pre_petition field? In case if
>> it is BLOB type of
>> >field, you cannot use Sort

>> >--
>> >Val Mazur
>> >Microsoft MVP


message

>> >> I am using the following code (I have also attached
my
>> XML
>> >> file) to try to load a RS from an XML file and sort
>> it.  I
>> >> know I could just sort the XML file, but I have my
>> reasons
>> >> for wanting to di it via ADO.  I keep getting a Sort
>> Order
>> >> Cannot Be Applied error.  Any ideas?

>> >> Dim rsXmlData
>> >> Dim oStream

>> >> Set rsXmlData = Server.CreateObject
("ADODB.Recordset")
>> >> Set oStream = Server.CreateObject("ADODB.Stream")

>> >> oStream.Open
>> >> oStream.Charset = "UTF-8"
>> >> oStream.LoadFromFile Server.MapPath
>> >> ("../xml/ACCT_LIST_SM.xml")
>> >> oStream.Position = 0

>> >> rsXmlData.CursorLocation = adUseClient
>> >> rsXmlData.CursorType = adOpenStatic
>> >> rsXmlData.LockType = adLockBatchOptimistic
>> >> rsXmlData.Open oStream

>> >> rsXmlData.Sort = "pre_petition DESC"

>> >.

>.

 
 
 

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. Strange problem with VB talking to SQL Server

3. creating ODBC datasource programmatically

4. Sort order cannot be applied - SOLUTION

5. How to build pubs2 database?

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

7. LDAP field values from 3rdparty Directory using ADSI

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