Ok, this should solve both of your questions. I've created a little sample script for you that you can use to determine what properties exist for a given connection. You can then manipulate and modify these properties by using them the same what I've displayed them.
Create a DTS package with 1 ActiveX Script Task and one generic Text File Destination connection (mine is named "Sample"). Load this script into your ActiveX Script Task:
Function Main()
dim sfilename, x, y
dim objpkg
set objpkg = dtsglobalvariables.parent
y = "DTS Package Connection (Sample) Properties" & vbcrlf & vbcrlf
for x = 1 to objpkg.connections("Sample").properties.count
y = y & objpkg.connections("Sample").properties(x).name & ": " & objpkg.connections("Sample").properties(x).value & vbcrlf
next
msgbox y
sfilename = objpkg.connections("Sample").properties("DataSourc e").value
msgbox "Current File Name: " & sfilename
sfilename = "C:\Testing.txt"
msgbox "Changed File Name: " & sfilename
objpkg.connections("Sample").properties("DataSourc e").value = sfilename
msgbox "Filename set to new value: " & objpkg.connections("Sample").properties("DataSourc e").value
set objpkg = nothing
Main = DTSTaskExecResult_Success
End Function
Run that script, and it'll go through and display, change, and set a new "DataSource" for your Text File Destination connection. Let me know if you have any questions -
bizzeau@hotmail.com - I've been working with DTS for just shy of FOREVER... ;)
Thanks,
Beau Frusetta
DBA/Developer