Solved

entering a text currency in database

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

810 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