Why does
scIns.Parameters.Add(new SqlParameter("@v30", 0.00m));
lead to a “@v30 undefined” error, but
decimal dZero = 0.00m;
scIns.Parameters.Add(new SqlParameter("@v30", dZero));
works OK?
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.
SqlParamter has two different overloads with two parameters, first being string and second being SqlDbType or object.
In the first case when 0.00m gets passed in it gets converted to Int64, and in the second case because the value passed in is of type decimal it then used the SqlDbType.Decimal.
Check out this Link
Update :
Found another stackoverflow Question that talks about this and has a detailed answer. 🙂