Subject: type mismatch error in VB Script
Posted By: spierson99 Post Date: 1/31/2006 9:15:02 PM
Hi --

I'm getting "type mismatch: 'objFSO.Copyfile' in the following VBScript. Any ideas why I can't copy the output from an SQL task in a DTS package? Thanks in advance.

Function Main()

dim objFSO
dim sSourceFile
dim sOutputFile

set objFSO = CreateObject("Scripting.FileSystemObject")
sSourceFile = DTSGlobalVariables("dexResults").Value
sOutputFile = "C:\dexresult.txt"

objFSO.CopyFile sSourceFile, sOutputFile

Main = DTSTaskExecResult_Success
Set ojbFSO = Nothing

End Function
Reply By: digby_dog Reply Date: 2/20/2006 6:05:28 AM
Worked for me.

I dont know what you are comying but I copied a simple file from one place to another without problem.
Reply By: David_the_DBA Reply Date: 2/20/2006 11:13:45 AM
I'll bet that it is a problem with your global variable dexResults. Global variable names are case sensitive. I am guessing that your global variable dexResults is not initialized. Either there is no dexResults global variable defined, it does not have a value or it is defined but as DexResults (maybe you have two variables defined).

To debug you can do one of two things, when running it manually you can use MsgBox DTSGlobalVariables("dexResults").Value

Or you can use DTSPackageLog.WriteStringToLog "dexResults is :" & DTSGlobalVariables("dexResults").Value
For more information on using WriteStringToLog see
http://www.mutuallybeneficial.com/index_files/dts_ssis_packages_portable.htm
For some examples on using Write string look at DTS ActiveX Logging Script.txt on that page.


David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com

Go to topic 40017

Return to index page 365
Return to index page 364
Return to index page 363
Return to index page 362
Return to index page 361
Return to index page 360
Return to index page 359
Return to index page 358
Return to index page 357
Return to index page 356