I’m using Linq-to-SQL query and using stored procedure in that. I’m getting error :
Specified cast is not valid.
How to solve it ?

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check your
TDetail.AMOUNTvalues.Your error is not when casting to an array, but rather in the
Convert.ToDouble(TDetail.AMOUNT).Run your stored proc with those same arguments (in SSMS or Visual Studio), and try to determine which value in TDetail.AMOUNT is causing this problem.
You’re seeing this exception being thrown when you cast to an array, but it would happen whenever you evaluated your LINQ query. It’s nothing to do with
ToArray(). It could beToList(), and you’d find the same exception.