Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting string to numeric
Message
 
À
29/05/2012 15:07:31
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01544642
Message ID:
01544669
Vues:
23
>>>>>>>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"
>>
>>Try Naomi's suggestion with Precision and Scale.
>
>I will; thank you. But does setting the type in my stored procedure as "numeric(10,2)" correct?

Sure Numeric is fine.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform