>>>>Yet another question on setting up values to parameters to be passed to a sql server stored procedure.
>>>>
>>>>Here is an example.
>>>>One of the parameters of the stored procedure is of type number:
>>>>
>>>>
>>>>@nTest numeric(10,2) OUTPUT
>>>>--- set value
>>>>set @nTest = 3333.33
>>>>
>>>>
>>>>Then in the C# code when creating the parameter I do the following
>>>>
>>>>param.DbType = System.Data.DbType.Decimal;
>>>>param.Value = 0;
>>>>param.Direction.InputOutput;
>>>>
>>>>
>>>>But after I call the oCommand.ExecuteNonQuery() I get error
>>>>
>>>>
>>>>Error converting data type numeric to numeric
>>>>
>>>>
>>>>What am I missing?
>>>>
>>>>TIA.
>>>>
>>>>UPDATE: The title of the thread is wrong. It should have said, Using Decimal type parameter.
>>>
>>>Shouldn't be SqlDbType.Decimal?
>>
>>You are probably right. But when I changed (in my C# code) the type to System.Data.SqlDbType.Decimal I get compiler error "An explicit conversion exist (are you missing a cast)." I don't understand what it mean though.
>
>Could you post C# code?
param.DbType = System.Data.DbType.Decimal;
param.Value = 0.00;
The above does not cause any compiler error but the ExecuteNonQuery() gives error.
When I change to the following:
param.SqlDbType = System.Data.SqlDbType.Decimal;
param.Value = 0.00;
I get compiler error.
"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