Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 25th, 2004, 06:36 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
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?

  #2 (permalink)  
Old February 25th, 2004, 06:40 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
  #3 (permalink)  
Old February 25th, 2004, 09:28 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
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


  #4 (permalink)  
Old February 26th, 2004, 04:06 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
  #5 (permalink)  
Old February 26th, 2004, 08:55 AM
Registered User
 
Join Date: Feb 2004
Location: , , .
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?

  #6 (permalink)  
Old February 26th, 2004, 09:18 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
  #7 (permalink)  
Old February 26th, 2004, 09:21 AM
Registered User
 
Join Date: Feb 2004
Location: , , .
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.

  #8 (permalink)  
Old October 3rd, 2004, 11:29 PM
Authorized User
 
Join Date: Aug 2004
Location: Calicut, Kerala, India.
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #9 (permalink)  
Old October 4th, 2004, 01:32 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:45 AM.


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