Specified cast is invalid RRS feed

  • Question

  • Given                
    Quote selectedQ = (from q in db.Quotes
         where q.QuoteKey == selectedItem.Value
         select q).Single();

    Why am I getting the Specified Cast in invalid on this line?  q.QuoteKey and selectedItem.Value are both int.
    Thursday, September 17, 2009 2:25 PM


  • Try:

    var test = db.Quotes.ToList(); to see if it is a problem with your query or actually a problem with the results.  I suspect it is the latter and that the database columns have changed type but the DBML/classes have not.

    • Marked as answer by Zhipeng Lee Wednesday, September 23, 2009 1:50 AM
    Thursday, September 17, 2009 3:24 PM