Re: Filled dataset decimal value not same as fetched value?
From: Tom Markham (TomMarkham_at_discussions.microsoft.com)
Date: 03/16/05
- Next message: Cowboy (Gregory A. Beamer) - MVP: "RE: SQL Database Connection Size"
- Previous message: Jonas: "Re: Data Access Block - FillDataSet and Output Parameters"
- In reply to: Val Mazur \(MVP\): "Re: Filled dataset decimal value not same as fetched value?"
- Next in thread: Ron Allen: "Re: Filled dataset decimal value not same as fetched value?"
- Reply: Ron Allen: "Re: Filled dataset decimal value not same as fetched value?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 16 Mar 2005 05:09:12 -0800
Hi Val,
I believe you misunderstood my problem. Maybe this will help. I am using
Microsoft's .NET Data Provider for Oracle. I instantiated a dataset, then I
executed the following query:
"SELECT 8.1 as NUM1, 8.12 as NUM2, 8.123 as NUM3, 8.1234 as NUM4, 8.12345 as
NUM5, 8.123456 as NUM6, 8.1234567 as NUM7, 8.12345678 as NUM8 FROM DUAL"
I filled my dataset with the query above. Then, I created a new DataRow
object for the dataset above and manually added the follow values to the new
datarow.
8.1
8.12
8.123
8.1234
8.12345
8.123456
8.1234567
8.12345678
Then I added the new row to the dataset.
Finally I iterated through the ItemArray of each datarow in the dataset,
getting each value and sending the output to the debug window.
It's quite astonishing actually. You should try it. What I end up with is
the following:
For the values filled from the query, all values with a odd number of
decimal places get an extra zero padded to them. The values with an even
number of decimal places are left alone.
For the values I entered manually, they are just as I would expect them to
be... the way I entered them.
So, you see, the problem isn't as cut and dry as rounding and/or
truncating... I would have been able to solve that on my own.
Any suggestions?
"Val Mazur (MVP)" wrote:
> Hi Tom,
>
> I believe rounding and truncating are totally different things. Even if you
> rounded number, it does not mean zeros will be truncated from the end. I do
> not know what Oracle has to manipulate datatypes, but if it has possibility
> to convert to decimal value with different precision, then this is what you
> need to remove this zero
>
> --
> Val Mazur
> Microsoft MVP
>
> http://xport.mvps.org
>
>
>
> "Tom Markham" <TomMarkham@discussions.microsoft.com> wrote in message
> news:F3F57C90-0571-4BA9-9D57-A77685E23E33@microsoft.com...
> > When I query my Oracle database for a decimal value, I explicitly specify
> > a
> > ROUND to one decimal place. When the value is filled into the dataset, the
> > value is stored with two decimal places. For instance, if the value I am
> > querying (and rounding in the SQL statement itself) is 8.5, the actual
> > value
> > in the dataset is 8.50.
> >
> > Now, I'm not going to argue that 8.5 is the same value as 8.50, but when
> > that 8.50 value is displayed in a grid... it is displayed as 8.50. This is
> > not good when I have validation code checking to make sure then user
> > didn't
> > enter a value with more than one decimal point.
> >
> > Note, I am not looking for a workaround to this issue. I would like to
> > solve
> > the problem at the source. I would like the value filled in the dataset to
> > be
> > the value retrieved from the database.
> >
> > What is really odd is that if the user types in 8.5 directly, the dataset
> > stores the value as 8.5. It isn't until the value is retrieved back from
> > the
> > database that it gets stored as 8.50.
>
>
>
- Next message: Cowboy (Gregory A. Beamer) - MVP: "RE: SQL Database Connection Size"
- Previous message: Jonas: "Re: Data Access Block - FillDataSet and Output Parameters"
- In reply to: Val Mazur \(MVP\): "Re: Filled dataset decimal value not same as fetched value?"
- Next in thread: Ron Allen: "Re: Filled dataset decimal value not same as fetched value?"
- Reply: Ron Allen: "Re: Filled dataset decimal value not same as fetched value?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|