Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Exemplo de como chamar um SSIS e verificar se correu correctamente usando o componente Script Task */
- using System;
- using System.Data;
- using Microsoft.SqlServer.Dts.Runtime;
- using System.Windows.Forms;
- namespace ST_6e1eb220f56e42238b2dd7e133b691d7.csproj {
- [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
- public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase {
- #region VSTA generated code
- enum ScriptResults {
- Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
- Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
- };
- #endregion
- public void Main() {
- // declare and instantiate a new DTS application
- Microsoft.SqlServer.Dts.Runtime.Application application = new Microsoft.SqlServer.Dts.Runtime.Application();
- // declare a DTS package and import a saved package file
- string the_path = "D:\\services_2011\\indicadores_gerais\\indicadores_gerais\\Package1.dtsx";
- Package the_package = application.LoadPackage(the_path, null);
- // handle possible errors
- try {
- // declare DTS result, and execute it
- DTSExecResult the_result = the_package.Execute();
- } catch(DtsException the_exception) {
- MessageBox.Show("The following error ocurred: " + the_exception.Message);
- }
- Dts.TaskResult = (int)ScriptResults.Success;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement