<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : orderby not working</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : orderby not working</description>
  <pubDate>Sat, 11 Apr 2026 06:09:12 -700</pubDate>
  <lastBuildDate>Thu, 24 Sep 2009 11:40:39 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=1491</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>orderby not working :  Originally posted by tj62 I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1491&amp;PID=5472#5472</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 1491<br /><strong>Posted:</strong> 24-Sep-2009 at 11:40am<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by tj62</strong></em><br /><br /><div>I don't know if this is the right place for my question. If notplease advice me what is thr right forum for it. <br></div></td></tr></table><br><br>Technically this is a LINQ question rather than a DevForce question, and you might get better answers on a LINQ forum somewhere.&nbsp; But you can always ask. We (IdeaBlade staff) have to give priority to the DevForce questions, but sometimes we enjoy practicing our LINQ, too; and there are, of course, lots of other LINQ users on this forum who may help.<br><br>I believe the problem is that your query is ordering the entities -- whatever their type name -- coming out of <font size="2">EntPointGroupAccessSet rather than the Customers you ultimately project out.&nbsp; <br></font><font size="2"><br></font>I created the following attempted analog of your query, targetting the NorthwindIB database that we ship with DevForce:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var customerQ = (from od in _mgr.OrderDetails<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where od.UnitPrice &gt; 50<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orderby od.Order.Customer.CompanyName<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select od.Order.Customer).Distinct();<br><br>Like you, I get Customers <i>not </i>sorted by CompanyName.<br><br><font size="2">But if I change the query to the following, I get the Customers sorted as desired:<br><br></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var customerQ = (from od in _mgr.OrderDetails<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where od.UnitPrice &gt; 50<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select od.Order.Customer).Distinct()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .OrderBy(c =&gt; c.CompanyName);<br><br>The corresponding query with your types would look like this:<br><br><font size="2" color="#0000ff"><font size="2" color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; var</font></font><font size="2"> customerQ = (</font><font size="2" color="#0000ff"><font size="2" color="#0000ff">from</font></font><font size="2"> c </font><font size="2" color="#0000ff"><font size="2" color="#0000ff">in</font></font><font size="2"> _manager.EntPointGroupAccessSet</font><div><font size="2" color="#0000ff"><font size="2" color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where</font></font><font size="2"> c.p_userID == </font><font size="2" color="#a31515"><font size="2" color="#a31515">"jhon"</font></font>&nbsp;&nbsp;&nbsp;&nbsp; <font size="2" color="#0000ff"><font size="2" color="#0000ff"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></font><font size="2" color="#0000ff"><font size="2" color="#0000ff">select</font></font><font size="2"> c.p_pointGroup.p_customer).Distinct()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .OrderBy(cust=&gt;cust.p_name);<br></font></div><font size="2"></font><font size="2"></font><font size="2"><font size="2" color="#0000ff"><font size="2" color="#0000ff"></font></font></font><br><br>]]>
   </description>
   <pubDate>Thu, 24 Sep 2009 11:40:39 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1491&amp;PID=5472#5472</guid>
  </item> 
  <item>
   <title>orderby not working : Hi, I don&amp;#039;t know if this...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1491&amp;PID=5467#5467</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=508" rel="nofollow">tj62</a><br /><strong>Subject:</strong> 1491<br /><strong>Posted:</strong> 24-Sep-2009 at 1:57am<br /><br />Hi,<DIV>I don't know if this is the right place for my question. If not please advice me what is thr right forum for it. I'm quite a newby in LINQ but with long experience with SQL...so I'm having a small learning curver barrier here. <BR><BR>I have a LINQ to entities query using navigation properties&nbsp;that is such:</DIV><DIV><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>var</FONT></FONT><FONT size=2> customerQ = (</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>from</FONT></FONT><FONT size=2> c </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>in</FONT></FONT><FONT size=2> _manager.EntPointGroupAccessSet</P><DIV></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>where</FONT></FONT><FONT size=2> c.p_userID == </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"jhon"</DIV></FONT></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>orderby</FONT></FONT><FONT size=2> c.p_pointGroup.p_customer.p_name</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2></P></FONT></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>select</FONT></FONT><FONT size=2> c.p_pointGroup.p_customer).Distinct();</P><DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2><P>foreach</FONT></FONT><FONT size=2>( </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>EntCustomer</FONT></FONT><FONT size=2> c </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>in</FONT></FONT><FONT size=2> customerQ )</P><P>{</P><P></FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>&nbsp;&nbsp;&nbsp; Console</FONT></FONT><FONT size=2>.WriteLine( </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Customer = "</FONT></FONT><FONT size=2> + c.p_name );</P><DIV></FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>&nbsp;&nbsp;&nbsp;&nbsp;Console</FONT></FONT><FONT size=2>.WriteLine();</DIV><P>}</P></FONT><DIV></DIV><DIV></DIV>This query is working perfectly except the orderby is not working the data output is unordered. Why is the orderby cluse ignored?<BR>How can I modify the query to get the order by working?</FONT></DIV></DIV>]]>
   </description>
   <pubDate>Thu, 24 Sep 2009 01:57:15 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1491&amp;PID=5467#5467</guid>
  </item> 
 </channel>
</rss>