Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in ActiveX script task 1

Status
Not open for further replies.

MDA

Technical User
Jan 16, 2001
243
US
Hi all,

I have a vbscript task that connects to a database and creates a text file... I am getting an error when the script tried to create the connection.

---------------
Error code 0
Error Source = Microsoft VBScript runtime error
Error Description: ActiveX component can't create object 'ADODB.connection'
----------------------------
The code is:

Function Main()
Dim fso,fil,txtStr,conObj,rsRst
set conObj = CreateObject("ADODB.Connection")
set rsRst = CreateObject("ADODB.Recordset")
...


If I run the DTS package from my computer it works fine. However, if I run from the server, the script fails. It seems there is a reference or some dll that it is trying to use?

Any ideas on the cause of this issue, or how I could fix it?

Best regards,

MDA
 
I think your code snippet's okay, it could be in your connection string to the server - especially if it works locally, but not with the different computer.
 
what is the error message being returned?

"Shoot Me! Shoot Me NOW!!!"
- Daffy Duck
 
Well the error is on LINE 2 whish is:

set conObj = CreateObject("ADODB.Connection")

More research I found was first to try to update IE to latest version and check the vbscript.dll and scrrun.dll files, which both are latest versions (no luck). Maybe some other dll is not registered?

Any other ideas?

Thanks again..

MDA
 
I doubt it is a dll issue. Rob999 is probably has the right answer in that it is a connection issue problem. Seeing that the error is being thrown when it you attempt to create the connection. Not having the text of the error message here are a few items to check.

1)Does the connection use a local SQL account or a Domain account.
2)If sql account is the server set to operate in mixed security mode
3) Does the account exist on the Server
4) Does the account have permissions to the Target database.
5) is the server name right in the connection string (Sounds stupid but I have seen this be a problem a number of times)


"Shoot Me! Shoot Me NOW!!!"
- Daffy Duck
 
MDXer the error is:

Error code 0
Error Source = Microsoft VBScript runtime error
Error Description: ActiveX component can't create object 'ADODB.connection'
Error on line 2

When I execute this step, it bombs and gives me the above message...


MDA
 
A bit of poking around shows this might be due to an issue with MDAC. Make sure you have the most recent MDAC installed.

"Shoot Me! Shoot Me NOW!!!"
- Daffy Duck
 
Thanks for you reply...

The connection is using the sa user (for now) in the script.

Here is a longer part of the code:
----------------------------------------
Function Main()
Dim fso,fil,txtStr,conObj,rsRst
set conObj = CreateObject("ADODB.Connection")
set rsRst = CreateObject("ADODB.Recordset")
conObj.Connectionstring = "PROVIDER = SQLOLEDB;DATA SOURCE = LASTEST;INITIAL CATALOG = Prism; USER ID = sa; PASSWORD = lastest"

conObj.open

set fso = CreateObject("Scripting.FileSystemObject")
fso.createtextfile "\\Finance\notes\Prism Dim " & Datepart("m", Now()) & "_" & Datepart("d", Now()) & "_" & Datepart("yyyy", Now()) & ".txt"
Set fil = fso.getfile("\\Finance\notes\Prism Dim " & Datepart("m", Now()) & "_" & Datepart("d", Now()) & "_" & Datepart("yyyy", Now()) & ".txt")

set txtStr = fil.OpenAsTextStream(2)

txtStr.Write "Notification Date -- " & Now() & vbCrLf & vbCrLf & vbCrLf

........

---------------------------------------
Does this uncover the issue?

Thanks for your time..

MDA
 

Well I don't know how to check the MDAC version but the SQL Server driver version is 2000.81.9031.14, which is close to the latest version, if not the latest. So that tells me that there is a new MDAC installed.

MDA
 
Hey guys,

Thanks for the help.. I have uncovered the mystery! Actually MDXer you were right on with the MDAC... I had 2.6 on the box and installed 2.7 sp1 (latest version) when nothing else worked. I don't think it was the version as much as maybe something missing or corrupted...

Thanks again for you time and help..

Regards,

MDA
 
MDA, I need some help using activeX to run a query in Access 2000. Do you think you could help?
 
Hey balistikb,

Sorry but I don't have Access experience, so I don't think I will be much help.

If you post your message in a new thread under the Access section, I am sure you will have people respond to you.

Thanks,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top