Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting string to numeric
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01544642
Message ID:
01544679
Views:
30
>>>>>>When I change to the following:
>>>>>>
>>>>>>param.SqlDbType = System.Data.SqlDbType.Decimal;
>>>>>>param.Value = 0.00;  
>>>>>>
>>>>>>
>>>>>>I get compiler error.
>>>>>
>>>>>What?
>>>>
>>>>What I wrote in the other message about "The explicit conversion exists (are you missing a cast?)"
>>>
>>>
>>>That works for me:
>>>
>>> SqlCommand sql = new SqlCommand();
>>>sql.Parameters.Add("asd");
>>>sql.Parameters[0].SqlDbType = SqlDbType.Decimal;
>>>sql.Parameters[0].Size = 10;
>>>sql.Parameters[0].Value = 0.00;
>>>sql.Parameters[0].Direction = ParameterDirection.InputOutput;
>>>
>>
>>The above code does not produce the compilere error. But when I call the stored procedure I get error "Error converting data type numeric to numeric"
>
>Can you post the stored procedure code?
>
>It sounds like you are trying to cast something that is already Decimal.

You are absolutely correct. I commented the link of setting the SqlDbType and all works. Since I was setting the value to 0.00 it was already decimal. Thank you very much.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform