Solved

entering a text currency in database

Posted on 2004-04-06
3
170 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
  • 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now