Solved

entering a text currency in database

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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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