Connecting Tech Pros Worldwide Forums | Help | Site Map

Using PI and ArcCos in SQL line

Newbie
 
Join Date: May 2009
Posts: 5
#1: May 26 '09
Hi folks,
I'm really stumped and need help .. on my ASP page, I'm running a line of SQL that has a calculation in it. In this calculation, I use PI and ARCCOS functions.

As my database is in Access, I have a module that has these functions detailed, but when I go to run the ASP page, it doesn't recognise these functions.

What can I do to get around this problem? Sorry if this is an obvious one, but i'm a newbie so please forgive me :o)

GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Posts: 145
#2: May 27 '09

re: Using PI and ArcCos in SQL line


One way would be to build a generic query object in the Access database, which can see your functions, and call that in your page, limiting its results.

"SELECT * FROM qrySomeQuery WHERE something = somethingelse"

Or you could import your functions across.

Gaz.
Newbie
 
Join Date: May 2009
Posts: 5
#3: May 27 '09

re: Using PI and ArcCos in SQL line


Hey, I tried importing the functions in, but I'm not sure that I did it right (I just pasted the functions in from the module and referenced them in the sql query, but it still didn't recognise it)?
GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Posts: 145
#4: May 27 '09

re: Using PI and ArcCos in SQL line


Quote:

Originally Posted by kliq316 View Post

Hey, I tried importing the functions in, but I'm not sure that I did it right (I just pasted the functions in from the module and referenced them in the sql query, but it still didn't recognise it)?

Have you tried the first approach?

Gaz.
Newbie
 
Join Date: May 2009
Posts: 5
#5: May 27 '09

re: Using PI and ArcCos in SQL line


Yeah, it didn't work .. it still didn't recognise the functions when accessing the page.
GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Posts: 145
#6: May 27 '09

re: Using PI and ArcCos in SQL line


Oh well, I guess you'll have to do the work on the recordset then!

Gaz.
Newbie
 
Join Date: May 2009
Posts: 5
#7: May 27 '09

re: Using PI and ArcCos in SQL line


There's no work to be done on the recordset. Don't worry about it, I'll figure it out.
GazMathias's Avatar
Expert
 
Join Date: Oct 2008
Location: Bristol, United Kingdom
Posts: 145
#8: May 27 '09

re: Using PI and ArcCos in SQL line


I think you miss understand me.

Instead of doing:

Expand|Select|Wrap|Line Numbers
  1. SELECT somefield, myfunction(someotherfield) As something FROM sometable
You do:

Expand|Select|Wrap|Line Numbers
  1. SELECT somefield, someotherfield FROM table
  2. ...
  3. Response.Write myfunction(rs("someotherfield"))
  4.  
Make sense?
Reply


Similar ASP / Active Server Pages bytes