Accessing stored procedure in Linq-to-SQL
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 ?
Check your TDetail.AMOUNT
values.
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 be ToList()
, and you'd find the same exception.
精彩评论