473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Datasync - decimal comparisons

Hi all,

I'm trying to update an SQL database by allowing users to upload a csv file
via webform. I then want to fill a datagrid to show what changes have been
made.

At first I tried using DataSets Merge, however this sets row states to
modified even if the rows are identical (which I didn't want for several
reasons). I changed the code to check for changes in the row... however when
it checks a decimal value the same value does not match! For example 43.5 in
both but if you look closer the lo value of one is 4350 and the other is 435.
I was converting all the objects ToString for comparison so one goes to
"43.50" and the other "43.5".

I'm not sure why it's doing this?! the scale of the decimal in the DB is 2
however when I create the DataTable to hold the csv data, I get the DataType
for the columns from the DataTable populated from the DB, so it should be the
same.

Does anybody have any suggestions for me?

Thanks
Gav
Oct 9 '07 #1
1 1270
Ignore that: Object.equals(Object) works as expected..

"Gav" wrote:
Hi all,

I'm trying to update an SQL database by allowing users to upload a csv file
via webform. I then want to fill a datagrid to show what changes have been
made.

At first I tried using DataSets Merge, however this sets row states to
modified even if the rows are identical (which I didn't want for several
reasons). I changed the code to check for changes in the row... however when
it checks a decimal value the same value does not match! For example 43.5 in
both but if you look closer the lo value of one is 4350 and the other is 435.
I was converting all the objects ToString for comparison so one goes to
"43.50" and the other "43.5".

I'm not sure why it's doing this?! the scale of the decimal in the DB is 2
however when I create the DataTable to hold the csv data, I get the DataType
for the columns from the DataTable populated from the DB, so it should be the
same.

Does anybody have any suggestions for me?

Thanks
Gav
Oct 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Dietrich Epp | last post by:
Without invoking double-underscore black magic, it is possible to choose a, b, and c in Python such that: a < b b < c c < a This could cause sorting functions to malfunction. >>> class...
17
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....
3
by: Kevin King | last post by:
I have a question about an assignment I have. I need to count the number of comparisons in my merge sort. I know that the function is roughly nlog(n), but I am definately coming up with too many...
5
by: Mattias Brändström | last post by:
Hello! I am trying to find a minimal class/lib that handles arbitrary precision decimal numbers. I would be happy if this class supported as little as addition, subtraction, multiplication,...
5
by: tajmorton | last post by:
Hello, First, some back ground: I am learning C++ while writing a custom inventory program for our (seed) business. I am using Qt as my toolkit, as the app needs to be compatible with both Windows...
4
by: illegal.prime | last post by:
Hi all, I have a class that I would like to use to hide the data type I'm using to store decimal point numbers. Failing all else, I will just use object and do conversion/casts as necessary. But...
4
by: Yuan HOng | last post by:
Hi, It seems decimal object will always be larger than float in comparasion, which goes against common sense: False True It seems to me that rather than allowing this to happen,...
17
by: D'Arcy J.M. Cain | last post by:
I'm not sure I follow this logic. Can someone explain why float and integer can be compared with each other and decimal can be compared to integer but decimal can't be compared to float? True...
6
by: Terry Reedy | last post by:
Gerhard Häring wrote: The new fractions module acts differently, which is to say, as most would want. True Traceback (most recent call last): File "<pyshell#20>", line 1, in <module> F(1.0)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.