 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 25th, 2004, 06:36 PM
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
undefined function
I have built your basic asp page that displays results from a microsoft access query. The problem is that the query in access references some functions I built. I thought when I ran the query via asp, it would execute that function within Access and just return the values to me; however, that is not the case as the ASP error page tells me there is an undefined function.
So my question is this: can I rebuild the function in the asp page and then run my query?
|
|

February 25th, 2004, 06:40 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Can you post the code / SQL statement you're executing? That will help in understanding the problem.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

February 25th, 2004, 09:28 PM
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Here is the SQL statement from the asp page, but it does not tell you to much. Below is the code from the query within Access:
<%
SQL_query = "SELECT * FROM QRY_WEB2"
Set RS = Conn.Execute(SQL_query)
%>
<%
WHILE NOT RS.EOF
%>
<B>Application Status:</B> <%=RS("down_app")%><br>
<B>Last Transaction Received:</B> <%=RS("dtime")%><br>
<B>Last Transaction Status:</B> <%=RS("down_time")%>
<%
RS.MoveNext
Wend
%>
-----------------------------
Here is the SQL statment in the Access query:
SELECT up_dtime.dtime, Now() AS localtime, up_dtime.status, GetElapsedMinutes([localtime]-[dtime]) AS Minutes, IIf([minutes]>5,"DOWN","UP") AS Down_Time, IIf([status]=1,"DOWN","UP") AS Down_App
FROM up_dtime;
-----------------------------
Here is the function I built in Access which the query references:
Function GetElapsedMinutes(interval)
Dim totalhours As Long, totalminutes As Long, totalseconds As _
Long
Dim days As Long, hours As Long, minutes As Long, Seconds As Long
days = Int(CSng(interval))
totalhours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
totalseconds = Int(CSng(interval * 86400))
hours = totalhours Mod 24
minutes = totalminutes
Seconds = totalseconds Mod 60
GetElapsedMinutes = minutes
End Function
|
|

February 26th, 2004, 04:06 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right, I see.
Unfortunately, this is by design. Take a look here: http://support.microsoft.com:80/supp.../Q166/1/13.asp
As a work around, you can recreate the function in ASP and use it in your SQL statement that you're passing. Not as elegant as a query, though.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

February 26th, 2004, 08:55 AM
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I wonder if I converted the db to Access 2000 and re-created the dsn using access 2000 drivers. I only mentino that because the mskb article specifically mentions access 97. Anyway, I will give that a shot and if it fails, I 'll just redo the function in asp. Can I just take my vb code and paste it in the asp page or do there need to be modifications?
|
|

February 26th, 2004, 09:18 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I think the exact same problem applies to other versions of Access as well. The problem is not necessarily with Access, but with the drivers connecting to Access.
Except for the string typing (As Long etc), you can pretty much Copy and Paste the function in an ASP (include) file.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

February 26th, 2004, 09:21 AM
|
|
Registered User
|
|
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Nevermind. I just embedded the function code within the query and it works great.
|
|

October 3rd, 2004, 11:29 PM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Is there any one who has found the solution for this?
|
|

October 4th, 2004, 01:32 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
As I said earlier in the thread, you can recreate the function in ASP.
As the article I linked to explained, user-defined modules cannot be used through ODBC or DAO. What other solution were you looking for?
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |