Editor .NET Order parameter

Editor .NET Order parameter

Chandler242Chandler242 Posts: 36Questions: 12Answers: 0

Hello,

.NET Query Order(string order) method has the following description about its Parameters

Type: System.String

Name: order

Description: Columns and direction to order by. Can be specified as individual names or a string of comma separated names. The 'asc' and 'desc' for each column (as in SQL) is optional.

I don't understand how to write the parameters. So far only Order ("par") works. Is there any way to include 'asc' or 'desc'?

Could you provide a example to list parameters as "individual names " and a separate example as "a string of comma separated names" please ?

Thank you,

YL

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    I believe it's just added with a space, so Order("par desc"), and comma-separated if multiples, so Order("field1 asc, field2 desc").

    Hope that does the trick,

    Colin

  • Chandler242Chandler242 Posts: 36Questions: 12Answers: 0

    Hey Colin,

    Thank you for the response.

    Order("par desc") did work. However,

    Order("field1 asc, field2 desc") didn't work. I had to use the following for multiple columns:

    Order(new string[] { "field ", "field2", "field3" })

    which seems to be the signature for multiple columns.

    What got me confused was the statement "Can be specified as individual names or a string of comma separated names."

    Thank you,

    YL

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    I think the individual names is what you've implemented, so each column is in it's own string within the array. Glad all sorted though!

    Colin

  • Chandler242Chandler242 Posts: 36Questions: 12Answers: 0

    Thank you, Colin. YL

Sign In or Register to comment.