PC Review


Reply
Thread Tools Rate Thread

Datasync - decimal comparisons

 
 
=?Utf-8?B?R2F2?=
Guest
Posts: n/a
 
      9th Oct 2007
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2F2?=
Guest
Posts: n/a
 
      9th Oct 2007
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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text box formatted to General Number with 2 decimal places NOTallowing the decimal place. p-rat Microsoft Access Form Coding 3 14th Jan 2008 05:20 PM
Make decimal work properly in fixed decimal entry in Excel 2003. =?Utf-8?B?am9obmdpaWk=?= Microsoft Excel Crashes 0 12th Apr 2006 06:05 AM
Converting 2-place decimal value to floating point decimal number with leading zero Kermit Piper Microsoft Excel Misc 3 18th Mar 2006 06:20 PM
FIXED 2 DECIMAL PLACES, MUST ENTER ALL ZEROES AFTER DECIMAL POINT. =?Utf-8?B?U1VLWUtJVFRZ?= Microsoft Excel Misc 3 6th Jul 2005 01:50 PM
Decimal class now preserves trailing zeroes after the decimal point Uncle Goh Microsoft Dot NET Framework 0 11th Sep 2003 09:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:16 PM.