Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Object required: '[undefined]' Error

Posted on 2004-04-28
8
Medium Priority
?
1,543 Views
Last Modified: 2011-09-20
I have an asp page which has this at line 214:  
Set rs = RunStoredProc("Select top 1 from tblName", "query")
  ... some code here
rs.close
Set rs = Nothing

This page also contains javascript to refresh this page every 60 seconds.  There are no problems with this page, but when the page is left up for a period of time .. ie: 30 minutes or longer, it will fail to refresh and displays the error mesage below.  I am not sure why this is happening.  Is there a solution to this?  Thanks.


The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.

----------------------------------------------------------------------------
----

Please try the following:

Click the Refresh button, or try again later.

Open the www.first-watch.us home page, and then look for links to the information you want.
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

----------------------------------------------------------------------------
----

Technical Information (for support personnel)

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[undefined]'
/alert_status2.asp, line 214


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)

Page:
GET /alert_status2.asp

Time:
Tuesday, April 27, 2004, 5:01:53 AM


More information:
Microsoft Support
 
0
Comment
Question by:wunyu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 9

Expert Comment

by:leechoonhwee
ID: 10936799
I think your connection timed out. When you refresh the page, does it open a new connection to the DB?
0
 

Author Comment

by:wunyu
ID: 10936882
This is the code for that function.  So whenever the page reloads, it calls this function again to run the query.  From this function, it looks like a new connection is created each time.

Function RunStoredProc(StoredProcedure, Params)
    Dim adoCmd, adoConn
      
      Set adoConn      = Server.CreateObject("ADODB.Connection")
      With adoConn
            .ConnectionTimeout = 30
            .CommandTimeout = 15
            .CursorLocation      = 3
            .Open ConnectionString
      End With
      
      Set adoCmd      = Server.CreateObject("ADODB.Command")
      With adoCmd
            On Error Resume Next
            .ActiveConnection = adoConn
            .CommandText = StoredProcedure
            If LCase(Params(0)) = "query" Then
                  .CommandType = 1
                  Set RunStoredProc = .Execute()
            ElseIf IsNull(Params(0)) Then
                  .CommandType = 4
                  Set RunStoredProc = .Execute()
            Else
                  .CommandType = 4
                  Set RunStoredProc = .Execute( ,Params)
            End If
            If Err.Number <> 0 Then
                  'Write to error log file here if necessary
            End If
            On Error Goto 0
      End With
      Set adoCmd = Nothing
      Set adoConn = Nothing
End Function
0
 
LVL 9

Expert Comment

by:leechoonhwee
ID: 10936943
Well. Your stored procedure did open a connection to the DB however the main recordset in the asp did not open the connection. You should have

Open conn
Open rs

Set rs = RunStoredProc("Select top 1 from tblName", "query")
  ... some code here
rs.close
Set rs = Nothing
Set Conn = Nothing

This way, the connection will be opened on every refresh.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:wunyu
ID: 10982518
If I added this code before Set rs = RunStoredProc(...):

      'Open Connection
      Set adoConn      = Server.CreateObject("ADODB.Connection")
      With adoConn
            .ConnectionTimeout = 300      'used to be 30s, now 300s
            .CommandTimeout = 300      'used to be 15s, now 300s
            .CursorLocation      = 3
            .Open ConnectionString
      End With
      
      Set rs = Server.CreateObject("ADODB.Recordset")
      rs.Open ???

What do I pass in as parameters to rs.Open?
I do not understand how rs uses the new adoConn connection if my next statement should be

Set rs = RunStoredProc("Select top 1 from tblName", "query")
  ... some code here
rs.close
Set rs = Nothing
Set Conn = Nothing

Am I missing something?

0
 

Author Comment

by:wunyu
ID: 11064367
Thanks leechoonhwee but didn't know how to use your solution.  How I solved it was setting the recordset to nothing beforehand.  I resume on error and check if the recordset is nothing.  If it is, I display a timeout message.  If it's not nothing, then I display the results as usual.  This way, at least the rest of the page shows and I won't get that Object required: '[undefined]' Error page.
0
 
LVL 9

Expert Comment

by:leechoonhwee
ID: 11064726
   Dim objConn, intParam
    intParam = 2
    Set objConn = Server.CreateObject("ADODB.Connection")
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objConn.Open "NWind" , "Guest", "welcome"

  ' Execute, Getstring and Write all on one line:
    Response.Write objConn.Execute("pGetEmployees " & intParam).GetString()

    Set objConn = Nothing


0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11098528
Closed, 100 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question