Unable to return float, always returning int with ADO, IIS and SQLServer 
Author Message
 Unable to return float, always returning int with ADO, IIS and SQLServer

Hi!

I'm having a strange "bug" or "feature" that I want to get rid of. I have an
ASP page running on IIS that connects to an SQLServer and does a simple
select from a view. In a select looks like this where I calculate a
percentage:

Select Int_one, Int_two, Int_one/Int_two *100 from view;

All it returns is the two integers and the integer of the percentage! It
seems as if it doesn't return a float number, but only an integer... I have
tried this one just to make sure that it can return float values:

Select Int_one, Int_two, Int_one/Int_two *100, 0.4 from view;

This one returns the two integers, the integer of the percentage and 0.4.
Hmm... Somehow it cuts the real part.
I have tried the convert the division into a float by using the CONVERT
function:

Select Int_one, Int_two, convert(float, Int_one/Int_two *100) from view;

With the same result!

I'm using ADO to connect to the SQLServer.

Is there any settings or so that I have to do to my connection so that it
will handle float values or something?

Post to newsgroup and directly to me if possible.

Remove the nospamplease if you mail me.

Best regards,
Magnus



Fri, 05 Oct 2001 03:00:00 GMT  
 Unable to return float, always returning int with ADO, IIS and SQLServer
I figured it out... If I use the convert function on Int_one only BEFORE the
division I will get a result contained in a float.

Magnus Andersson

Quote:

> Hi!

> I'm having a strange "bug" or "feature" that I want to get rid of. I have an
> ASP page running on IIS that connects to an SQLServer and does a simple
> select from a view. In a select looks like this where I calculate a
> percentage:

> Select Int_one, Int_two, Int_one/Int_two *100 from view;

> All it returns is the two integers and the integer of the percentage! It
> seems as if it doesn't return a float number, but only an integer... I have
> tried this one just to make sure that it can return float values:

> Select Int_one, Int_two, Int_one/Int_two *100, 0.4 from view;

> This one returns the two integers, the integer of the percentage and 0.4.
> Hmm... Somehow it cuts the real part.
> I have tried the convert the division into a float by using the CONVERT
> function:

> Select Int_one, Int_two, convert(float, Int_one/Int_two *100) from view;

> With the same result!

> I'm using ADO to connect to the SQLServer.

> Is there any settings or so that I have to do to my connection so that it
> will handle float values or something?

> Post to newsgroup and directly to me if possible.

> Remove the nospamplease if you mail me.

> Best regards,
> Magnus



Sun, 07 Oct 2001 03:00:00 GMT  
 Unable to return float, always returning int with ADO, IIS and SQLServer
Try to convert Int_one or Int_two to float before calculating
Int_one/Int_two.

Regards
Konstantin

On Mon, 19 Apr 1999 21:07:17 +0200, "Magnus Andersson"

Quote:

>Hi!

>I'm having a strange "bug" or "feature" that I want to get rid of. I have an
>ASP page running on IIS that connects to an SQLServer and does a simple
>select from a view. In a select looks like this where I calculate a
>percentage:

>Select Int_one, Int_two, Int_one/Int_two *100 from view;

>All it returns is the two integers and the integer of the percentage! It
>seems as if it doesn't return a float number, but only an integer... I have
>tried this one just to make sure that it can return float values:

>Select Int_one, Int_two, Int_one/Int_two *100, 0.4 from view;

>This one returns the two integers, the integer of the percentage and 0.4.
>Hmm... Somehow it cuts the real part.
>I have tried the convert the division into a float by using the CONVERT
>function:

>Select Int_one, Int_two, convert(float, Int_one/Int_two *100) from view;

>With the same result!

>I'm using ADO to connect to the SQLServer.

>Is there any settings or so that I have to do to my connection so that it
>will handle float values or something?

>Post to newsgroup and directly to me if possible.

>Remove the nospamplease if you mail me.

>Best regards,
>Magnus



Thu, 25 Oct 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ADO does not always return Errors collection from SQL 2000

2. ADO Recordset should be returning Rows, but .EOF is always True

3. ADO SQL Search That Returns 0 Records When it Should Return 1

4. Get the int[ ] return value in Win32_BIOS

5. Return fractional portion of a floating-point value

6. VB and MS-SQLServer Return code

7. float return type in Automation

8. Return fractional portion of a floating-point value

9. HELP!!!! IIS - ADO/SQLServer periodically returns only the first record of a recordset!

10. Unable to return ouput parameters to VB.net component - novice question

11. Unable to return output parameters - please help

12. Unable to Return Connection Object from a DLL

 

 
Powered by phpBB® Forum Software