Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting string to numeric
Message
De
30/05/2012 01:41:33
 
 
À
29/05/2012 14:48:28
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01544642
Message ID:
01544728
Vues:
24
>I'm with Borislav on this. .Net types aren't the same as DB types. To confuse things even more, you have things like
>
>param.Value = DbNull.Value;
>
>
>Since when does Null have a value?

That's perfectly valid - equivalent of x==null in C#

>
>>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform