Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/167306-vbscript-runtime-error-800a01a8/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.