Solved

entering a text currency in database

Posted on 2004-04-06
3
174 Views
Last Modified: 2013-12-24
i was able to enter a text currency into an access database as text, but now i do not know what to define the field type as since i have moved to mysql...i have tried double and char ,neither worked

all that showed up was

$
0
Comment
Question by:finnstone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 10768530
you can use a decimal type and set the precision to the number of decimal places you want.

Then when outputting on your pages use #DollarFormat(fieldname)#

Here is more information on mapping data types from Access to MySQL :
http://www.fonlow.com/zijianhuang/dbconverter/mysql2access_matrix.html
0
 

Author Comment

by:finnstone
ID: 10768590
can you be more exact, i am using an insert statement, how can i insert a variable that is a text currency, how do i insert it , and what should i set the field type as

should i do a mid to strip out the $ sign
0
 
LVL 35

Accepted Solution

by:
mrichmon earned 500 total points
ID: 10768630
In the MySQL database your field type should be decimal with a precision of 2.  This can be defined as decimal(18,2)

Then in the cold fusion code if you have a variable like this :

<cfset myvar = "$5.00">

You could save it to the database as Right(myvar, Len(myvar) - 1) which would take all of the characters after the $

If you had it in the page as 5.00 then you just write directly to the database.

And to display it on the screen you would do :

#DollarFormat(myquery.fieldname)#
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question