my codes:
Private objConnect As DTS.Connection2
Private objPackage As DTS.Package2
. . .
'Create the connection object. The package is already created at this point.
Set objConnect = objPackage.Connections.New("SQLOLEDB.1")
With objConnect
.ID = 1
.DataSource = "localserver"
.UseTrustedConnection = True
End With
Set objPackage.Connections.Add = objConnect

actually, these codes are copied from sql onlinebook. but when I tried to run them in VB6, an error occurred on the Add method: Argument not optional. I have looked up add method in the reference, no special argument was mentioned. while the usual syntax for add is add (objconn as connection), but if I change
Set objPackage.Connections.Add = objConnect
Set objPackage.Connections.Add (objConnect)
it says: compile error: syntax error.
so how can I add an connection to the connections collection?