Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9272559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:54:05+00:00 2026-06-18T15:54:05+00:00

We need to retrieve a sorted list of items. The sort order is to

  • 0

We need to retrieve a sorted list of items. The sort order is to be related to an arbitrary list of items’ guids. I.e. it might be 1, 2, 3, 4 as well as 3, 7, 2, 4.

We’re not using LINQ-to-SQL nor stored procedures.

I suggested that we fetch the list in the order SQL Server provides it and sort it using LINQ in the C# code.

The alternative to that is to create a string like this (following this tip).

select * from publishers
Order by (CASE City
 WHEN 'Paris'    THEN 1
 WHEN 'Chicago'  THEN 2
 WHEN 'Boston'   THEN 3
 WHEN 'New York' THEN 4
 ELSE 100 END) ASC, City DESC

I must admit that there’s a certain neatness to this approach but I really prefer to play with data operations in C#. I can’t come up with a good shoot-down to the other approach, so I’ll have to admit that it’s a working one.

What are the drawbacks here? (Except for the obvious of injections, of course, which isnät a problem for us. We need not to worry about security issues, luckily.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:54:06+00:00Added an answer on June 18, 2026 at 3:54 pm

    I would personally go for database centric solution. If I need sort or page a data, I almost always try to do it on DB server side (usually using SQL and/or StoredProcedures).

    Benefits are evident:

    1. Server is usually is the most powerful machine in the your app system, so let’s give the hard work to it. Also because it’s tuned to do the hard work for us.

    2. One time data prepared on the server, sometimes it means that it also reduced its size too (filtered or fetched concrete page), so the data amount transmitted to the client is drastically reduced, which benefit to a user in faster response time.

    If you’re fetching all at once (as you mentioned), at least, the first point remain something that you can consider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to retrieve information from two separate models which are similar but not
i need to retrieve the page title from an URL i already have using
I need to retrieve data from two tables. the first is a list of
I need to retrieve a list of all the files that have been checked-in
I need to retrieve a list of all files of a certain type on
I currently have a long list which is being sorted using a lambda function
Today it's 06/11/2012. I need retrieve the last day of the current year using
I need to retrieve records that match IDs stored in a list. The query,
Hi I'm new to Oracle 10g. I need retrieve the all the sublist from
I need to retrieve a value from a website (can vary and I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.