Solved

WScript.CreateObject not working suddenly

Posted on 2014-12-09
7
152 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add 'N to prepared ASP/VB insert statement 1 37
I am new to using JSON in SQL Server 2 57
T-SQL: Need to trim a single leading space 7 62
SQL query 45 39
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
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…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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