Conversion of string to Decimal
-
Hi Everyone, Iam struck with sending a decimal parameter to a stored procedure. Can anyone help us in this regard cm.Parameters.Add("@test", SqlDbType.Decimal);
Regards, Manowj
-
Hi Everyone, Iam struck with sending a decimal parameter to a stored procedure. Can anyone help us in this regard cm.Parameters.Add("@test", SqlDbType.Decimal);
Regards, Manowj
Edit: It seems I was incorect with this statemnt.
-
Hi Everyone, Iam struck with sending a decimal parameter to a stored procedure. Can anyone help us in this regard cm.Parameters.Add("@test", SqlDbType.Decimal);
Regards, Manowj
To parse a string that contains a numeric value, e.g. "123.45", to a Decimal, I recommend System.Decimal.TryParse[^].
-
What error are you getting?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
-
Hi, I am getting the below error when i passed cm.Parameters.Add("@Qty", SqlDbType.Decimal); Failed to convert parameter value from a String to a Decimal.
Regards, Manowj
-
Hi, I am getting the below error when i passed cm.Parameters.Add("@Qty", SqlDbType.Decimal); Failed to convert parameter value from a String to a Decimal.
Regards, Manowj
No string should be involved; how are you setting the Value of the parameter? I would use
cm.Parameters.AddWithValue("@Qty", datetimepicker.Value )
Don't make a value into a string and then parse it back to the type is was.