Forum Moderators: open

Message Too Old, No Replies

ADODB recordset in ASP

         

manjumurthy

11:43 am on May 22, 2002 (gmt 0)



I have a query which fetches amount field from the SQL database. The SQL datatype for the field is LONG. I have values like .00,.01, 1.00 etc. stored in the table. When i fetch these values using the sql query they are fetched correctly, but when i display the same using the ADODB recordset, they are displayed as 0,1 i.e the decimals are truncated, Can anyone help me?

bsolutions

11:51 am on May 22, 2002 (gmt 0)



Have you tried specifying the data type in the asp.

ie clng(variable) or cdbl(variable)

Also, are you sure you ahve the correct data type, A long will only store whole numbers (ie 0.1 will equate to 1)
For floating point numbers I would use a double data type for accurracy.

I hope this helps.

manjumurthy

12:03 pm on May 22, 2002 (gmt 0)



I'm sure about the datatype is LONG. I executed the same query directly in the query analyser, it fetches the correct result i.e with decimals. When I execute the same query through the ADODB object in ASP, & fetch the result using the recordset, the decimals get truncated. I tried using the conversion functions of ASP also but didn't help...

bsolutions

12:09 pm on May 22, 2002 (gmt 0)



have you tried the function

formatnumber(variable,no of decimal places)

Xoc

2:49 pm on May 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The Long data type doesn't allow the storing of fractions.