SQL error with EntryQuery


When running

// Query EntryQuery entryQ = new EntryQuery();
// Author UserAuthorCriterion authorC = new UserAuthorCriterion(); authorC.User = new UserCriterion(); authorC.User. authorC.User.ID = new IntegerCriterion(); authorC.User.ID.Value = dqcUser.Id; entryQ.Author = authorC;
// Given user's guestbook BlogCriterion blogC = new BlogCriterion(); blogC.ID = new IntegerCriterion(); blogC.ID.Value = dqcUser.Guestbook.Id; entryQ.Blog = blogC;

// Add OR group CriteriaGroup orGroup = new CriteriaGroup(); orGroup.AddCriterion(LogicalOperator.Or, authorC); orGroup.AddCriterion(LogicalOperator.Or, blogC); entryQ.AddCriteriaGroup(orGroup);
// Get result EntryCollection scEntryCollection = BlogHandler.GetQueryResult(entryQ, page, pageSize, out totalItems);

I get an exception with this message

Incorrect syntax near '('.  Incorrect syntax near 'entry0_'.

I used the SQL Server Profiler to look at the actual SQL, then replaced the parameters @p0 and @p1 with the values from the profiler. Running this query directly of course gave the same error, but I got it to execute if I added an "AND" in the code.

SELECT   TOP 2147483647 ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__,   COUNT(*) OVER() AS __hibernate_total_rows_nr__,    entry0_.intID as intID15_,   entry0_.intBlogID as intBlogID15_,   entry0_.strTitle as strTitle15_,   entry0_.strContent as strContent15_,   entry0_.strSenderIP as strSende5_15_,   entry0_.datTimeStamp as datTimeS6_15_,   entry0_.datUpdated as datUpdated15_,   entry0_.intNumComments as intNumCo8_15_,   entry0_.intImageGalleryID as intImage9_15_,  entry0_.datPublicationStart as datPubl10_15_,   entry0_.datPublicationEnd as datPubl11_15_,   entry0_.intAuthorID as intAuth12_15_    from tblStarCommunityBlogEntry entry0_, vwStarCommunityAuthor iauthor1_    where     (     (      (iauthor1_.intUserID IS NOT NULL  and       entry0_.intAuthorID=iauthor1_.intID)      AND      (       iauthor1_.blnAnonymous=0       AND /* added an AND here to make it work */       (        (         iauthor1_.intUserID=33          and          entry0_.intAuthorID=iauthor1_.intID        )       )        and        entry0_.intAuthorID=iauthor1_.intID      )     )     OR     (      (       (entry0_.intBlogID=281 )      )     )    )

Am I doing something wrong with the EntryQuery, or might this actually be a bug?

Best regards,

Dec 01, 2008 18:13

It sounds like this may be a bug.

Please report it at http://world.episerver.com/en/Support/Register-Support-Incident/  with the above information as well as product version.




Dec 02, 2008 9:24
Dec 02, 2008 18:04


This is now reported in the Support system and verified as a bug.


Dec 23, 2008 11:42
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.