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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

activex error 1

Status
Not open for further replies.

DTSFreak

IS-IT--Management
Feb 24, 2005
28
NL
Hi,

I'm having some trouble debugging the following script i used from sqldts.com.

----------------------------------------------------------------------------------------
' 246 (DefineTheGVs)
Option Explicit

Function Main()

Dim fso
Dim fold
Dim pkg
Dim stpContinuePkg
Dim stpExitbadDirectory

' First thing we need to do is to check if our directories are valid.

SET pkg = DTSGlobalVariables.Parent

SET stpContinuePkg = pkg.Steps("DTSStep_DTSActiveScriptTask_3")
SET stpExitBadDirectory = pkg.Steps("DTSStep_DTSActiveScriptTask_2")

DTSGlobalVariables("gv_FileCheckErrors").Value = ""

'We use the FileSystemObject to do our
'Folder manipulation

set fso = CREATEOBJECT("Scripting.FileSystemObject")


'Here we check to make sure the Source folder for the files exists

if fso.FolderExists(DTSGlobalVariables("gv_FileLocation").Value) <> "True"
then
DTSGlobalVariables("gv_FileCheckErrors").Value =
CSTR(DTSGlobalVariables("gv_FileCheckErrors").Value) &_
" " & "Source File directory Not Found"
end if

'Here we check to make sure the Archive folder for the files exists

if fso.FolderExists(DTSGlobalVariables("gv_ArchiveLocation").Value) <>
"True" then
DTSGlobalVariables("gv_FileCheckErrors").Value =
CSTR(DTSGlobalVariables("gv_FileCheckErrors").Value) &_
" " & "Archive File directory Not Found"
end if

'We predefined the GlobalVariable gv_FileCheckErrors = "" which
'has a length of 2 so we check to see if it has expanded. If it has then
we
'know we had an error and we disable the step that would
'allow us to continue in the package and enable the step
'that takes us out and handles the errors we encountered

If len(DTSGlobalVariables("gv_FileCheckErrors").Value) > 2 Then
stpContinuePkg.DisableStep = True
stpExitBadDirectory.DisableStep = False
Else
stpContinuePkg.DisableStep = False
stpExitBadDirectory.DisableStep = True

end if

Main = DTSTaskExecResult_Success
End Function
-----------------------------------------------------------------------------------------

The script is part of dts package in sql server. The package
imports files and archive them into another directory.

The problem is when i run the package it fails at above mentioned script.
The error i'm getting says that the source and archive folders are not found
even if i know for certain that they exists. The paths to the files are set
in a global variable which one can insert in the property page of the dts.
Even when the correct paths are set up, the script fails.

I tried to figure it out (there are no debugtools in dts for vbscript), so i
removed the folder checks and it works. All files are imported into the
database.

So my question is what is wrong with this picture?


 
what do you get wen you echo DTSGlobalVariables("gv_FileLocation").Value ?

maybe try the cstr function also in the folderexist line of code?

Let me know...

--------------------------------------
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
 
Hi kob3,

I figured it out. The problem was that i was on a pc with dutch settings.

The line where it checks if it exists is <> "true" should be in my case "waar". So i adjusted it to "true" or "waar".

Anyway i didn't know that vbscript was country dependent:)
 
Ik ook niet ;-)
(translated: I Didn't either)


_____________________________________
Feed a man a fish and feed him for a day.
Teach a man to fish and feed him for a lifetime...
 
try and avoid the use of the "" in your True, just have True with no "" otherwise you are asking vbscript to expplicitly convert to a string then compare which will cause you a problem.
from the problems i have experienced i never use True or false for my booleans, i always stick with 1 and 0 you cant go too wrong with that.

also for the

If FSO.FolderExists this will be all you need to do

If FSO.FolderExists Then

Else

End If

or

If Not FSO.FolderExists Then

Else

End If

i.e. you dont have to bother checking for true or false or 1 or 0 as the code handle that for you, if you get my drift
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top