Hi peeps,

I currently have a ActiveX Script Task(vbscript) that loops through a specific directory and returns all the files in that directory. The Filename is assigned to a global variable. Now everytime a filename is returned it should insert it into the "mytable" table in the database. How do I do this??? Here is my current code...

Code:
Function Main() 
    dim oFileName
    oFileName = "C:\Program Files\"

    dim oFso 
    set oFso = CreateObject("Scripting.FileSystemObject")

    dim oFolder
    set oFolder = oFso.GetFolder(oFileName)

    dim oFile 

    for each oFile in oFolder.Files
        'Wscript.Echo "File Name: " & oFile.path
        
        'populate variable 
        DTSGlobalVariables("gvFileFullName").Value = oFile.path
        
        'execute a different task to insert data into a table 
        'insert into mytable (FullPathName) values (DTSGlobalVariables("gvFileFullName").Value)
    next
    
    'wscript.echo "Completed"
    
    'continue with package
    Main = DTSTaskExecResult_Success
End Function
Should I create a a sql task with syntax:
Code:
 insert into mytable (FullPathName) values (?)
then assign the value of the gvFileFullName global variable to "?", but to I execute this task again? Once the loop has completed I would like to continue to the next step in the dts package.

Thanks in advance guys...