NOODB: TAKE and ORDER BY

TAKE is the LINQish equivalent of top. But, it doesn’t exist in the query expression; it’s an extension method.

I’m just tacking it on to the end of the query, at least for now.

I added a RECENT REVIEWS page to the DvdFriend test site. The NOODB query is:

from r in MovieReview take 20

Of course, there should be a SELECT in there, but I’ve been avoiding that.

The next thing I need is to “order by ReviewDate descending”. I haven’t done that yet, but did manually tack it onto the end of the SQL query just to see it work. It worked fine once I addressed the order issues covered in the previous post.

I looked at the linq syntax for order by. When you do it via code, the first sort field is an OrderBy, and all subsequent sort fields are specified by ThenBy. But, looking at the query expresions, I only see ORDER BY. Apparently, it does the THEN by automatically. I’ll find out soon enough.

noodb

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: