Solved

WScript.CreateObject not working suddenly

Posted on 2014-12-09
7
146 Views
Last Modified: 2014-12-11
All of a sudden this line is producing an error (we made no changes to code):

Set rs = WScript.CreateObject("ADODB.Recordset")

Open in new window


Microsoft VBScript runtime error '800a01a8'

Object required: 'WScript'

/weather.asp, line 15


The full code is as follows:

   Dim sSQL, rs
	Dim count
		
	sSQL = "SELECT wea_id, wea_url FROM CLR_Weather "
	
	Set rs = WScript.CreateObject("ADODB.Recordset")
	
    rs.Open sSQL, CONNSTR
		
	if NOT rs.EOF then
		do While not rs.EOF

			call getWeather(rs.Fields("wea_url"),rs.Fields("wea_id"))
			rs.movenext
		loop
	end if
	
	rs.Close()
	Set rs = Nothing		

Open in new window

0
Comment
Question by:intoxicated_curveball
  • 3
  • 2
  • 2
7 Comments
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
ID: 40489690
There was no way that was working before, WScript doesn't have a recordset property to it. It should be

Set rs = Server.CreateObject("ADODB.Recordset")
0
 

Author Comment

by:intoxicated_curveball
ID: 40489745
It was absolutely working before. It's been working for years up until recently. I can even show you other peoples code that are using the same methodology:

https://community.oracle.com/thread/2603156?start=0&tstart=0
http://computer-programming-forum.com/59-vbscript/bcd1c59d5b5b2e64.htm
http://stackoverflow.com/questions/19594056/vbscript-function-variable-not-resolving

Perhaps it's been deprecated ?
0
 

Author Closing Comment

by:intoxicated_curveball
ID: 40489805
Despite what I said, your solution did work, so thank you!
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 11

Expert Comment

by:zalazar
ID: 40489833
Can you try to add
Option Explicit

Open in new window

at the beginning of the script and see if this helps.
0
 
LVL 32

Expert Comment

by:Big Monty
ID: 40490086
@zalazar:  adding "Option Explicit:" will only ensure you have all of your variables declared without any typos. The error the author was getting was related to not being able to initiate a recordset object

@IC: those links were pointing to cases where the code was strictly vbscript, and not classic asp (which I assumed this question was for). if it's just for vbscript, you should be able to get away with

Set rs = CreateObject("ADODB.Recordset")

either way, I'm glad you got it working :)
0
 
LVL 11

Expert Comment

by:zalazar
ID: 40492697
@Big Monty, thanks, I know. But after reading this thread it seems that it does a little bit more sometimes.
http://www.experts-exchange.com/Programming/Languages/Scripting/ASP/Q_21869129.html
0
 
LVL 32

Expert Comment

by:Big Monty
ID: 40493926
interesting, I've not come across Option Explicit doing anything but forcing you to declare variables. I wish they had provided some kind of reference for what they were discussing, oh well :)

I did stumble across this article saying that Option Explicit could be used to enhance performance, unfortunately the link they referenced to is broken and I can't find any other info on it.

Either way, thx for pointing that out :)
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

18 Experts available now in Live!

Get 1:1 Help Now