Solved

Object required: '[undefined]' Error

Posted on 2004-04-28
8
1,521 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
  • 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 information …
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/…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now