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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS doesnt execute from code ...why?

Status
Not open for further replies.

skitty123

Technical User
May 4, 2004
56
US
trying to execute a DTS package (that loads data into a table), no errors are thrown, .. why does it not do anything?
( I set one global variable , but even if i hard code it into the package and try to run I get the same result: no errros and package is not run)
//--------------------------code begin
Package2Class package = new Package2Class();
object pVarPersistStgOfHost = null;
package.LoadFromSQLServer("(local)",null, null,DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection,null,null,null,packageName,ref pVarPersistStgOfHost);

package.GlobalVariables.Remove("gv_startDate");
package.GlobalVariables.AddGlobalVariable("gv_fordate", gvValue);

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

// force Release() on COM object
System.Runtime.InteropServices.Marshal.ReleaseComObject(package);
package = null;

//code end
 
...correction in code: the variable name is "gv_fordate" so both lines 7 and 8 shoudl read:

package.GlobalVariables.Remove("gv_fordate");
package.GlobalVariables.AddGlobalVariable("gv_fordate", gvValue);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top