title: right sql query
body: <p>I have the following problem. In my database table I have a coloum with  the name ItemDaysNext (the coloumn is an integer). The value is ever null and this is ok....</p>
  
  <p>I would like use this coloumn after for a sort value...</p>
  
  <p>This satement works fine:</p>
  
  <pre><code>var query = from item in items
                      let today = DateTime.Today
                      let birthday = item.ItemDate
                      let next = new DateTime(today.Year, birthday.Month, birthday.Day)
                      let next2 = next &lt; today ? next.AddYears(1) : next
                      orderby (next2 - today).Days ascending
                      select item;
  </code></pre>
  
  <p>But I would like use the result from "(next2 - today).Days" into the ItemDaysNext because then I can sort after better a Listbox because I can bind the value...</p>
  
  <p>This statement doesn't work and I become a compiler error message (InvalidCastException)</p>
  
  <pre><code>var query = from item in items
                      let today = DateTime.Today
                      let birthday = item.ItemDate
                      let next = new DateTime(today.Year, birthday.Month, birthday.Day)
                      let next2 = next &lt; today ? next.AddYears(1) : next
                      orderby (next2 - today).Days ascending
                      select new { ItemDaysNext = (next2 - today).Days };
  </code></pre>
  
  <p>How can I make the correct Query????</p>
  
  <p>Best regards for all answers.</p>