Solved

Object required: '[undefined]' Error

Posted on 2004-04-28
8
1,532 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
Technology Partners: 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!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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