Solved

Object required: '[undefined]' Error

Posted on 2004-04-28
8
1,523 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP equivalent to Windows findstr 3 71
Classic ASP - cannot find folder on the server 5 31
Classic ASP + JS 4 81
SMS AddAttachment Protocol Error Classic ASP 10 37
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 …
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

16 Experts available now in Live!

Get 1:1 Help Now