Solved

WScript.CreateObject not working suddenly

Posted on 2014-12-09
7
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 33

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
Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

 
LVL 12

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 33

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 12

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 33

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…

691 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