Wrox Programmer Forums
|
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
 
Old February 25th, 2004, 06:36 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?

 
Old February 25th, 2004, 06:40 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old February 25th, 2004, 09:28 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old February 26th, 2004, 04:06 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old February 26th, 2004, 08:55 AM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?

 
Old February 26th, 2004, 09:18 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old February 26th, 2004, 09:21 AM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind. I just embedded the function code within the query and it works great.

 
Old October 3rd, 2004, 11:29 PM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there any one who has found the solution for this?

 
Old October 4th, 2004, 01:32 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined function 'Left' in expression Morris Access 13 July 23rd, 2008 02:07 AM
Undefined Function Error arimakidd Beginning PHP 2 November 10th, 2005 02:54 AM
Call to undefined function mysql_connect() tks_muthu PHP Databases 2 June 14th, 2005 01:23 AM
Undefined function dhborchardt Classic ASP Databases 0 June 7th, 2004 03:31 PM
undefined function: mysql_connect() shabboleth Beginning PHP 2 September 18th, 2003 05:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.