Managing DTS Package Programs

DTS Programming

DTS Programming

Managing DTS Package Programs

You can either run the configured Package2 object or save it in several formats. You also can load a saved Data Transformation Services (DTS) package into a Package2 object.

Executing Packages

After you have created the hierarchy of DTS objects and set their properties, as needed, use the Execute method of the Package2 object to execute the package. DTS may raise errors from the Execute method. For more information about handling these errors, see Handling DTS Events and Errors.

If you plan to do anything further with the Package2 object, release all references to other DTS objects, then use the UnInitialize method.

For more information, see Executing DTS Packages in Visual Basic.

Saving and Loading Packages

You can save the package as a project in your current development environment. You can also save it in the formats in which DTS tools save packages. To do the latter, use one of the following methods of the Package2 object.

Methods Description
SaveToRepository, SaveToSQLServer, SaveToStorageFile Save the package to a specified storage type.
SaveToRepositoryAs, SaveToSQLServerAs, SaveToStorageFileAs Assign a new name and package ID to the package, then save it to a specified storage type.
SaveAs Assign a new name and package ID to the Package2 object, but do not save it to storage.

To load a Package2 object with the state of a previously saved package, use the LoadFromSQLServer, LoadFromRepository, or LoadFromStorageFile methods. You can delete saved packages by using the RemoveFromSQLServer and RemoveFromRepository methods.

For more information about saving and loading DTS packages, see Saving DTS Packages in Visual Basic.