|
jonance -> RE: Round currency field to 2 decimal places (3/23/2004 10:46:14)
|
I'll try to clarify...here is the sql for the update function <% fp_sQry="UPDATE products SET price=::newprice:: WHERE price=::oldprice::" fp_sDefault="newprice=&oldprice=" fp_sNoRecords="No records returned." fp_sDataConn="louisvilleguide" fp_iMaxRecords=0 fp_iCommandType=1 fp_iPageSize=0 fp_fTableFormat=False fp_fMenuFormat=False fp_sMenuChoice="" fp_sMenuValue="" fp_iDisplayCols=16 fp_fCustomQuery=True BOTID=0 fp_iRegion=BOTID %> I have a form where the client enters an amount in the field 'oldprice'. This is the price that is already in the database, and should be replaced by the amount he enters in another field called 'newprice' in the same form. This form posts to an asp page with the above sql update function in a DRW. The problem is that in the database, in the price field (which is in the currency format), what appears at first glance to be, say $36.34 on the site is actually $36.3421 (4 decimals) in the database. So when he enters 36.34 in the 'oldprice' field, and whatever he wants the new price to be....it doesn't replace it because it is not actually a match. He would need to type in 36.3421 (which i verified works). But on the site, he doesn't see those numbers, why would he, it is currency and there are only two decimals. What i need to do is truncate all of the prices that are ALREADY in the database to 2 decimal points, and drop the extra two. I have the currency field set to 2 decimals...but apparenty that only is the display and it still saves as 4 decimals...b/c when i click on the actual number in the DB, all for decimals are reveals, hence the problem. So i'd like to know the easiest way for me to do this with existing records and ensure any new records will be okay as well....should i change the format from currency, and if so...to what? Thanks, John
|
|
|
|