SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one list in which there is field with the datatype of Yes/No. I am trying to retrieve data of that field but it is giving me following error :

System.InvalidCastException: Specified cast is not valid. at Microsoft.SharePoint.Linq.SPQueryable.GetSPFieldValue[T](PropertyMap pm, DataContext dc, SPListItem item, Object entity, JoinPath joinPath) at lambda_method(ExecutionScope , SPListItem ) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)

My query is as follows:

var query = (from san in db.San
             select san.IsDeclaredCompleted).ToList();

So can anyone suggest me what i am doing wrong?

share|improve this question
up vote 0 down vote accepted

Try to put ToList() method after db.San: db.San.ToList()
more detail

share|improve this answer
i have tried it.....and only thing changed is the error.... – Stark Jul 16 '12 at 11:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.