Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WScript.CreateObject not working suddenly

Posted on 2014-12-09
7
Medium Priority
?
158 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 34

Accepted Solution

by:
Big Monty earned 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 34

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 34

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

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…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

609 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