This is because ToString() is turned into a MethodGroup and then parsed and translated to SQL. Since there is no ToString() equivalent this is not executed and fails.
Try parsing before the linq query and use the parsed variable in linq query
string str =Product.Name.ToString();// parsing
var list=from u in dbcontext.Orders where u.Productname== str select u;
edit | flag
Gokul A Answered on: Feb 08, 2012 at 9:14PM
Post your Answer
Welcome to Ask Amoeba! This is 100% free and interactive site for sharing professional Questions and Answers, Opensource projects, Interview questions. Learners, beginners, Experts stop and share your knowledge and ideas!