Solved

entering a text currency in database

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

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

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

Suggested Solutions

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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