SOF User
SOF User

Reputation: 7830

using linq with subsonic 3

How can I do this task define in comments please help me...

var qry = DB.Select.From("EventListing").OrderDesc("CreatedOn").Where("StartTime", Comparison.GreaterThan,
SelectedDate.AddDays(-1));
// TODO LIMIT TO TOP (based on Max) RESULTS
// where StartTime is the same date as SelectedDate
//qry.TopSpec = "5";
var events = qry.ExecuteTypedList<EventListing>();

Upvotes: 0

Views: 113

Answers (1)

IndigoDelta
IndigoDelta

Reputation: 1481

Not completely clear on the problem but if you are just looking for the top X results then use the Take() method. MSDN Page. For your example the usage would be:

var qry = DB.Select.From("EventListing").OrderDesc("CreatedOn").Where("StartTime", Comparison.GreaterThan, SelectedDate.AddDays(-1)).Take(5);

Upvotes: 2

Related Questions