In a datagrid's itemdatabound sub, I've got a dataitem for a SQL Server field
of type decimal (3,2) with a value of 0.99. Query is straightforward: Select
* from tablename. When I use a watch to check the dataitem value, it shows as
1D. If I use a watch to look at the cell text (e.item(i).text) it shows the
correct "0.99" value. Anyone know why the dataitem would show a rounded value
and how to make it stop?
tia,
Sue 2 1861
Hi Sue,
If you're using .NET 1.1, have you tried the DataFormatString attribute of
the BoundColumn? You can specify it as DataFormatString="{0:n}" which formats
the data with 2 decimal places.
Hope that helps,
Calvin
"Sue" wrote: In a datagrid's itemdatabound sub, I've got a dataitem for a SQL Server field of type decimal (3,2) with a value of 0.99. Query is straightforward: Select * from tablename. When I use a watch to check the dataitem value, it shows as 1D. If I use a watch to look at the cell text (e.item(i).text) it shows the correct "0.99" value. Anyone know why the dataitem would show a rounded value and how to make it stop?
tia, Sue
Hi Calvin. Yes, the DataFormatString is already there to make sure that at
least two decimal places display, even if they're a zero value.
Unfortunately, in this instance, the value displayed is 1.00, even though it
s/b 0.99.
thanks though!
Sue
"Calvin KD" wrote: Hi Sue,
If you're using .NET 1.1, have you tried the DataFormatString attribute of the BoundColumn? You can specify it as DataFormatString="{0:n}" which formats the data with 2 decimal places.
Hope that helps, Calvin
"Sue" wrote:
In a datagrid's itemdatabound sub, I've got a dataitem for a SQL Server field of type decimal (3,2) with a value of 0.99. Query is straightforward: Select * from tablename. When I use a watch to check the dataitem value, it shows as 1D. If I use a watch to look at the cell text (e.item(i).text) it shows the correct "0.99" value. Anyone know why the dataitem would show a rounded value and how to make it stop?
tia, Sue This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Batista, Facundo |
last post by:
Here I send it.
Suggestions and all kinds of recomendations are more than welcomed.
If it all goes ok, it'll be a PEP when I finish writing/modifying the code.
Thank you.
.. Facundo
|
by: John Bentley |
last post by:
John Bentley:
INTRO
The phrase "decimal number" within a programming context is ambiguous. It could
refer to the decimal datatype or the related but separate concept of a generic
decimal number....
|
by: Rob Oldfield |
last post by:
From the documentation about Decimal.Round....
"When d is exactly halfway between two rounded values, the result is the
rounded value that has an even digit in the far right decimal position. For...
|
by: Rick Gabel |
last post by:
Trying to use the decimal datatype with SQL Server2000 and C#.Net and having
a rounding problem.
I am using SqlCommand/SqlParameter process to retrieve and insert a record
into the table. One...
|
by: vooose |
last post by:
Consider a rounding up function:
public static decimal RoundUp(decimal val, decimal round)
{
return ((decimal)Math.Ceiling((double)(val/round)))*round;
}
Math.Ceiling (and Math.Floor for...
|
by: spebola |
last post by:
I am using vb.net 2003 professional and I get the following results
when using the round method:
dim Amount as decimal = 180.255
Amount = Amount.Round(Amount, 2)
Amount now contains 180.25. ...
|
by: Matt |
last post by:
Anybody noticed that SQL Server rounds up if the value is half way
between two rounded values, but C#'s Decimal.Round(Decimal,Int32)
rounds to nearest even number?
>From MSDN: "When d is exactly...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I convert a Number into a String with
exactly 2 decimal places?...
|
by: Anodes |
last post by:
I have a decimal variable. I'd like it to store a number rounded to
two decimal places.
I've declared and loaded it like this:
CODE
private Decimal FileSize_MB_DataFile = 0.0M;...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |