none
Calling DTS Package from a C# code RRS feed

  • Question

  •  

    How can i call DTS package from C# code?...

    Please let me know. Please post sample and syntax.

    Wednesday, October 17, 2007 6:40 PM

Answers

  • Hi Visio!

     

    try this

     

    Code Block

    object pVarPersistStgOfHost = null;
    DTS.Package pkg = new DTS.Package();
    pkg.LoadFromSQLServer("VServer","VUser","VP888",DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, null,null,null,"DTSUpdateDbaseFilet",ref pVarPersistStgOfHost);
    pkg.Execute();

     

    but don't forget to include the COM Component "Microsoft DTSPackage Object Library" to your references to be able to access the DTS object.

     

    Cheers,

    Andrey.

     

    Wednesday, October 17, 2007 10:11 PM

All replies

  • Hi Visio!

     

    try this

     

    Code Block

    object pVarPersistStgOfHost = null;
    DTS.Package pkg = new DTS.Package();
    pkg.LoadFromSQLServer("VServer","VUser","VP888",DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, null,null,null,"DTSUpdateDbaseFilet",ref pVarPersistStgOfHost);
    pkg.Execute();

     

    but don't forget to include the COM Component "Microsoft DTSPackage Object Library" to your references to be able to access the DTS object.

     

    Cheers,

    Andrey.

     

    Wednesday, October 17, 2007 10:11 PM
  • hi dev,

    can you please help me to set configuration file for the loaded package from sqlserver;

     

    as per my code;

    Application ap = new Application();
    Package pk1 = ap.LoadFromSqlServer("\\PROJECT", "itsssqldb", "pmo_package_user", "password", null);
    pk1.ImportConfigurationFile(@"\Packages\dev_staging.dtsConfig");
    pk1.Execute();

     

    Here the problem is its not accepting the configuration file what i supplied!!!

    Can you help me out?

    Tuesday, December 18, 2007 1:43 PM