executing DTS packages in C#

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

How do you execute a DTS package from C#? I have some code that doesn't
work because the structured storage file cannot be found :

[MTAThread]
static void Main(string[] args)
{
// TODO: Add code to start application here
Package2Class package = new Package2Class();

object pVarPersistStgOfHost = null;

//loadfromsqlserver
package.LoadFromStorageFile(
"c:\\TransferTxtFileToTable.dts",
null,
null,
null,
"Test Package",
ref pVarPersistStgOfHost);

package.Execute();
package.UnInitialize();

package = null;
}

Has anybody else had this problem, and does anybody know how to solve
it? Any help would be really appreciated.


Cheers,

Mike
 
null out the name of the package, as below, or correct the name by specifying
the name you named the package when you saved it.

//sample with nulled out package name
package.LoadFromStorageFile(
"c:\\TransferTxtFileToTable.dts",
null,
null,
null,
null,
ref pVarPersistStgOfHost);

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top