Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecified cast is not valid. ListView and Linq
    text
    copied!<p>I have problem when i using ListView and Linq as datasource. The error down:</p> <pre><code> Specified cast is not valid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Specified cast is not valid. System.Data.SqlClient.SqlBuffer.get_Int64() +58 System.Data.SqlClient.SqlDataReader.GetInt64(Int32 i) +38 Read_ForumThreadPostDetail(ObjectMaterializer`1 ) +95 System.Data.Linq.SqlClient.ObjectReader`2.MoveNext() +29 System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +96 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +7667556 System.Linq.Enumerable.ToList(IEnumerable`1 source) +61 </code></pre> <p>Source code</p> <pre><code>Public IEnumerable&lt;IForumThreadPost&gt; GetForumPostByThreadAndPost() { ScoutDataDataContext sd = new ScoutDataDataContext(); long ThreadId = Convert.ToInt64(HttpContext.Current.Request.QueryString["id"]); long PostId = Convert.ToInt64(HttpContext.Current.Request.QueryString["postId"]); ///.Skip((pageIndex - 1)*pageSize).Take(pageSize) + int pageIndex, int pageSize return sd.ForumThreadPostDetails .AsEnumerable() .Where(f =&gt; f.ThreadId.Equals(ThreadId) &amp;&amp; f.PostId.Equals(PostId)) .Select(f =&gt; new IForumThreadPost { Id = f.Id, ThreadId = f.ThreadId, PostId = f.PostId, Title = f.Title, ThreadTitle = f.ThreadTitle, Content = f.Content, UserFullName = f.UserFullName, UserId = f.UserId }).ToList(); // error here } </code></pre> <p>This function has work before, so i don't can figure out what the problem is. Thanks for your help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload