I'm writing a query to retrieve some data from a DynamicDataStore in Episerver. When I run the code I get the following error:
System.Data.SqlClient.SqlException: Incorrect syntax near '>'.
Here's the relevant query:
BlogContentStore store = new BlogContentStore();
IQueryable<UwlBlogPost> posts = store.Posts.Where(p => Blog == p.BlogId && p.ReadyToPost && p.PostOn <= DateTime.Now);
if (taggedPeople.Count() > 0 || taggedDepartments.Count() > 0 || taggedDepartments.Count() > 0)
{
posts = posts.Where(p => p.PeopleTags.Intersect(taggedPeople).Count() > 0
|| p.DepartmentTags.Intersect(taggedDepartments).Count() > 0
|| p.KeywordTags.Intersect(taggedKeywords).Count() > 0);
}
posts = posts.OrderByDescending(p => p.PostOn).Take(DisplayCount);
The syntax for everything looks alright to me, and it compiles okay.