Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cannot get the decimals portion of a numeric field
Message
 
 
À
04/04/2008 12:27:14
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01308259
Message ID:
01308277
Vues:
7
>I have a SQL command that is included some calculcated fields such as:
>
>
>SELECT Client.Name,0 AS Amount FROM Client
>
>
>Then, later on in the code, I can assign a value in the Amount field by the use of the DataRow. This is working good as long as I am using VFPOleDb. As soon as I switch to the SQLClient provider to use a SQL Server backend, I have found out that even if I put 23.23 in the Amount field, I will end up with 23.
>
>I need to avoid changing the SQL. Is there a way down below the code that I can adjust the datatype for that column so it will know that I wish to deal with decimals?

Can you use CAST in your select statement to properly assign the datatype?

E.g. CAST(0 as N(10,2)) as Amount ?

This would work in both versions.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform