smallmoney
-
How can I get rid of the value of 3000.0000 since its datatype is money ? I would like it to be 3000, not 3000.0000. The code is: Dim pMoney As SqlParameter = New SqlParameter("@Money", SqlDbType.Money, 8) pMoney.Value = Trim(CInt(txtMoney.Text)) cmdUpdate.Parameters.Add(pMoney) Did I overlook something ? Thanks!
-
How can I get rid of the value of 3000.0000 since its datatype is money ? I would like it to be 3000, not 3000.0000. The code is: Dim pMoney As SqlParameter = New SqlParameter("@Money", SqlDbType.Money, 8) pMoney.Value = Trim(CInt(txtMoney.Text)) cmdUpdate.Parameters.Add(pMoney) Did I overlook something ? Thanks!
The problem is not in how you are storing it (Actually your expectations are the only problem). 3000 in smallmoney is accurate to four decimal places, so it == 3000.0000 when stored. How are you viewing the result? Unless you apply formatting to the display/print, the default would be to display it at full precision. Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed. Carl Sandburg
-
The problem is not in how you are storing it (Actually your expectations are the only problem). 3000 in smallmoney is accurate to four decimal places, so it == 3000.0000 when stored. How are you viewing the result? Unless you apply formatting to the display/print, the default would be to display it at full precision. Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed. Carl Sandburg
Rob, Hee hee, my expectation is just simple and easy. 4 decimal places isn't what I want it in my project but I can't change the precision in the Design Table of the SQL Ext. Manager. I did try CInt(txtMoney.text) but it won't get rid of the 4 decimal places. (i.e. from 4500.0000 to 4500) Thanks for replying.
-
How can I get rid of the value of 3000.0000 since its datatype is money ? I would like it to be 3000, not 3000.0000. The code is: Dim pMoney As SqlParameter = New SqlParameter("@Money", SqlDbType.Money, 8) pMoney.Value = Trim(CInt(txtMoney.Text)) cmdUpdate.Parameters.Add(pMoney) Did I overlook something ? Thanks!
In C# I cast it to a
decimal
and then to adouble
and then convert it to astring
, and it only outputs the decimals that are not 0 (10.5 instead of 10.5000). Something like:string s = ((double) (decimal) row["MoneyAmount"]).ToString();
In VB.NET you could try something similar and it might work. -- LuisR
Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!