dbTalk Databases Forums  

ActiveX Syntax Help

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss ActiveX Syntax Help in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
martino
 
Posts: n/a

Default ActiveX Syntax Help - 09-01-2004 , 07:58 PM






Hello,

I am trying to write a vb script that would check
not one but the existence of two files before it goes into
the next dtstask.

I tried to use dtsglobalvariables, but is the same problem
as if i have before with the function below:


Function Main()
Main = CheckFile(FILE1,FILE2)


End Function


Function CheckFile(sFileName1, sFileName2)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If (fso.FileExists(sFileName1,sFileName2)) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function

This does not work, I got an error on the vb script
dtstask,

any help is very welcome!!! thanks




Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: ActiveX Syntax Help - 09-02-2004 , 12:17 AM






OK

I cannot find or remember that FileExists takes two - n filenames as
arguments

When you figure that part out I would have the function return like this

if == found

CheckFile = CBool(True)

if != Found

CheckFile ==CBool(False)


not

CheckFile = DTSTaskExecResult_Success and
CheckFile = DTSTaskExecResult_Failure


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"martino" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello,

I am trying to write a vb script that would check
not one but the existence of two files before it goes into
the next dtstask.

I tried to use dtsglobalvariables, but is the same problem
as if i have before with the function below:


Function Main()
Main = CheckFile(FILE1,FILE2)


End Function


Function CheckFile(sFileName1, sFileName2)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If (fso.FileExists(sFileName1,sFileName2)) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function

This does not work, I got an error on the vb script
dtstask,

any help is very welcome!!! thanks






Reply With Quote
  #3  
Old   
Darren Green
 
Posts: n/a

Default Re: ActiveX Syntax Help - 09-02-2004 , 03:38 AM



If you check the syntax for FileExists it only accepts one parameter.
http://msdn.microsoft.com/library/de...fileexists.asp



Function CheckFile(sFileName1, sFileName2)
Dim fso

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(sFileName1) And fso.FileExists(sFileName2) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function


--
Darren Green
http://www.sqldts.com

"martino" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello,

I am trying to write a vb script that would check
not one but the existence of two files before it goes into
the next dtstask.

I tried to use dtsglobalvariables, but is the same problem
as if i have before with the function below:


Function Main()
Main = CheckFile(FILE1,FILE2)


End Function


Function CheckFile(sFileName1, sFileName2)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If (fso.FileExists(sFileName1,sFileName2)) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function

This does not work, I got an error on the vb script
dtstask,

any help is very welcome!!! thanks






Reply With Quote
  #4  
Old   
martino
 
Posts: n/a

Default Re: ActiveX Syntax Help - 09-02-2004 , 08:47 AM



it works beautifully!!
thanks a lot Darren, Allan


Quote:
-----Original Message-----
If you check the syntax for FileExists it only accepts
one parameter.
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/script56/html/jsmthfileexists.asp



Function CheckFile(sFileName1, sFileName2)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If fso.FileExists(sFileName1) And fso.FileExists
(sFileName2) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function


--
Darren Green
http://www.sqldts.com

"martino" <anonymous (AT) discussions (DOT) microsoft.com> wrote in
message
news:476801c49087$f011a750$a501280a (AT) phx (DOT) gbl...
Hello,

I am trying to write a vb script that would check
not one but the existence of two files before it goes
into
the next dtstask.

I tried to use dtsglobalvariables, but is the same
problem
as if i have before with the function below:


Function Main()
Main = CheckFile(FILE1,FILE2)


End Function


Function CheckFile(sFileName1, sFileName2)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If (fso.FileExists(sFileName1,sFileName2)) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function

This does not work, I got an error on the vb script
dtstask,

any help is very welcome!!! thanks





.


Reply With Quote
  #5  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: ActiveX Syntax Help - 09-02-2004 , 02:09 PM



Just one word though.

Do you really want to return a failure because a file does not exist? Why
not handle things gracefully because let's face it the thing didn't fail per
se did it?

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"martino" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
it works beautifully!!
thanks a lot Darren, Allan


-----Original Message-----
If you check the syntax for FileExists it only accepts
one parameter.
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/script56/html/jsmthfileexists.asp



Function CheckFile(sFileName1, sFileName2)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If fso.FileExists(sFileName1) And fso.FileExists
(sFileName2) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function


--
Darren Green
http://www.sqldts.com

"martino" <anonymous (AT) discussions (DOT) microsoft.com> wrote in
message
news:476801c49087$f011a750$a501280a (AT) phx (DOT) gbl...
Hello,

I am trying to write a vb script that would check
not one but the existence of two files before it goes
into
the next dtstask.

I tried to use dtsglobalvariables, but is the same
problem
as if i have before with the function below:


Function Main()
Main = CheckFile(FILE1,FILE2)


End Function


Function CheckFile(sFileName1, sFileName2)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If (fso.FileExists(sFileName1,sFileName2)) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function

This does not work, I got an error on the vb script
dtstask,

any help is very welcome!!! thanks





.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.