Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executing DTS package from C#

Status
Not open for further replies.

monkeymeister

Programmer
Mar 17, 2005
58
GB
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
 
Where are you executing your C# syntax? I think its the issue with your path. The recommeneded way is, make the folder shared to the user its executing the script and its shoudl be on SQL server.
Also rather than using path like this 'c:\TransferTxtFileToTable.dts' use
'\\Servername\Sharename\TransferTxtFileToTable.dts'
This shoudl work



Dr.Sql
Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top