Adding values of ASP fields generated by different SQL statements

I

Ian

I have two fields on a WEB page which are generated by two different SQL
statements. I want to do some calculations using the values returned
outside of the ASP code. Can anybody tell me the format of the commands I
will have to use in HTML at achieve this? And are there any gottas?

Thanks

Ian
 
J

Jens Peter Karlsen[FP MVP]

What calculations?

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
I

Ian

Re: Adding values of ASP fields generated by different SQL statementsIn effect the SQL statements will display two calculated values from a database using a SUM statement or COUNT statement. I want to manipulate the numbers to produce additional information. I've tried using a CASE statement in the SQL command but this is failing at the moment, example below. What I want to know is it possible to have a number generated by ASP then manipulated via HTML and what format name should be used to access the ASP values?

select idno , value , (CASE when idno <= 5 then value * 6

else value * 4 END) charge

from records

Regards

Ian



What calculations?

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
S

Stefan B Rusynko

The below part is invalid syntax for a Case statement and in a Select
(CASE when idno <= 5 then value * 6 else value * 4 END) charge

If you are manipulating "value" just do the math after the select

select idno , value from records
If idno <= 5 Then
charge = value * 6
Else
charge = value * 4
End If




Re: Adding values of ASP fields generated by different SQL statementsIn effect the SQL statements will display two calculated values
from a database using a SUM statement or COUNT statement. I want to manipulate the numbers to produce additional information. I've
tried using a CASE statement in the SQL command but this is failing at the moment, example below. What I want to know is it
possible to have a number generated by ASP then manipulated via HTML and what format name should be used to access the ASP values?

select idno , value , (CASE when idno <= 5 then value * 6

else value * 4 END) charge

from records

Regards

Ian



What calculations?

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
J

Jon Spivey

Looks like he's using sql server in which case it's nearly valid - should be

SELECT idno, [value], CASE idno when < 6 then [value] * 6 else [value] * 4
END AS SomeAlias, Charge
FROM Table

--
Cheers,
Jon
Microsoft MVP


Stefan B Rusynko said:
The below part is invalid syntax for a Case statement and in a Select
(CASE when idno <= 5 then value * 6 else value * 4 END) charge

If you are manipulating "value" just do the math after the select

select idno , value from records
If idno <= 5 Then
charge = value * 6
Else
charge = value * 4
End If




Re: Adding values of ASP fields generated by different SQL statementsIn
effect the SQL statements will display two calculated values
from a database using a SUM statement or COUNT statement. I want to
manipulate the numbers to produce additional information. I've
tried using a CASE statement in the SQL command but this is failing at the
moment, example below. What I want to know is it
possible to have a number generated by ASP then manipulated via HTML and
what format name should be used to access the ASP values?

select idno , value , (CASE when idno <= 5 then value * 6

else value * 4 END) charge

from records

Regards

Ian



What calculations?

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
-----Original Message-----
From: Ian [mailto:[email protected]]
Posted At: 29. marts 2005 20:38
Posted To: microsoft.public.frontpage.programming
Conversation: Adding values of ASP fields generated by
different SQL statements
Subject: Adding values of ASP fields generated by different
SQL statements


I have two fields on a WEB page which are generated by two
different SQL statements. I want to do some calculations
using the values returned outside of the ASP code. Can
anybody tell me the format of the commands I will have to use
in HTML at achieve this? And are there any gottas?

Thanks

Ian
 
I

Ian

I've managed to resolve my issues (well at least this one.....). I decided
not to use the Database Wizard and switched to the old fashion route of
gathering data and using VB to do the caculations, works great.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top