Hybride Posted July 24, 2009 Share Posted July 24, 2009 Am working for this company who requested me to put up their old website up due to some problems with the new company. Unfortunately, I have never programmed in VBScript and this code is about 10 years old (from what they tell me), so I have zero comments to go by as the old company was kind enough not to write any in. I receive the error: Microsoft VBScript runtime error '800a01a8' Object required: 'DatabaseConnectDefault' /LM/W3SVC/41627477/Root/includes/ApplicationVariableRefresh.asp, line 7 I get that the object has to be initialized, however, I have no idea how or where. This is the ApplicationVariableRefresh page: <SCRIPT LANGUAGE=VBScript RUNAT=Server> sub ApplicationVariableRefresh application.lock Application("WSCommerceInitialized") = "1" dim rs,Conn set conn = DatabaseConnectDefault if isObject(Conn) then set rs = conn.execute("sproc_ApplicationVariablesRetrieve") while not rs.eof application(trim(rs("Name"))) = Trim(rs("Value").value) rs.MoveNext wend end if application.unlock end sub </script> From the error line, that would be the "set conn = DatabaseConnectDefault." Here is the database connection script: <SCRIPT LANGUAGE=VBScript RUNAT=Server> function DatabaseConnectDefault dim Conn dim ConnectString dim SQLServer dim UserID dim Password dim Database SQLServer = "localhost" UserID = "user" Password = "pass" Database = "database" ConnectString = "driver=SQL Server;server=" & SQLServer & ";uid=" & UserID & ";pwd=" & Password & ";database=" & Database & ";" Err.clear on Error resume next Set Conn = Server.CreateObject("ADODB.Connection") conn.connectiontimeout = 120 conn.CommandTimeout = 120 Conn.open ConnectString if err.number = 0 then set DatabaseConnectDefault = Conn else DatabaseConnectDefault = NULL end if end function function DatabaseConnect(SQLServer, UserID, Password, Database) dim Conn, ConnectString ConnectString = "driver=SQL Server;server=" & SQLServer & ";uid=" & UserID & ";pwd=" & Password & ";database=" & Database & ";" Err.clear on Error resume next Set Conn = Server.CreateObject("ADODB.Connection") conn.connectiontimeout = 120 conn.CommandTimeout = 120 Conn.open ConnectString if err.number = 0 then set DatabaseConnect = Conn else DatabaseConnect = NULL end if end function </script> If anyone has an idea or can help, I'd be very much obliged. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/167306-vbscript-runtime-error-800a01a8/ Share on other sites More sharing options...
captbeagle Posted July 25, 2009 Share Posted July 25, 2009 A VBscript error 800a01a8 means that an illegal method was called. After a careful read of your code, I think I found your problem. In line 5, you initialized the variables 'rs' and 'Conn', yet in line 6, you set the value to 'conn'. In line 7, you again refer to 'Conn'. Thus, you've got an illegal object reference. See if by changing the variable name in line 6, if you can get that error to go away. If it doesn't work, I'll take a closer look. Quote Link to comment https://forums.phpfreaks.com/topic/167306-vbscript-runtime-error-800a01a8/#findComment-882562 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.