Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FLOAT problem

Status
Not open for further replies.

gwp

Programmer
Jan 15, 2003
4
SE
Hi!

I´m running ASP and MySQL where I´m using the datatype FLOAT.

When I submit a value, for example myValue=’50.5’ it works fine and when I check the value in the database it is 50.5

But then, when I try to print this on a .asp page - using SELECT myValue AS nVal – RS(“nVal”) I get the value 50 printed.

What is causing the rounded value, is it a WIN/ASP/MySQL setting or am I doing something wrong?

Thanks in advance for any answers /The Swedish Pike
 
To begin with, I would not use

Code:
myVal = '50.5'

with a numeric column type. The quotes tell MySQL to expect a string -- drop the quotes when inserting the data around numeric values going into a numeric column type. Even if it does not fix this problem, you can get a performance boost.

Also, I'm confused as to what

Code:
SELECT myValue AS nVal – RS(“nVal”)

is supposed to do. The "AS" keyword sets up an alias for a column. You generally use it like this:

Code:
SELECT 1 + 2 AS three;

will return:

Code:
+-------+
| three |
+-------+
|     2 |
+-------+

This gives a name MySQL can associate with a calculated column that would not normally have one.


Want the best answers? Ask the best questions: TANSTAAFL!
 
Thanks for your reply!
I´m sorry about the confusion, I did not write the complete code. I use it because i call several tables with identical column names. Like this....
myTable1.myValue AS myVal1 , myTable2.myValue AS myVal2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top