Home Forums Data Warehousing Integration Services Type or namespace name 'Runtime' does not exist in the namespace 'Microsoft.SqlServer.Dts' RE: Type or namespace name 'Runtime' does not exist in the namespace 'Microsoft.SqlServer.Dts'

  • Sure...this is what's in the Script task:

    using System;

    using System.Data;

    using Microsoft.SqlServer.Dts.Runtime;

    using System.Windows.Forms;

    namespace ST_1f50902ce699477fb3cbca2a4fa27b80.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

    /*

    The execution engine calls this method when the task executes.

    To access the object model, use the Dts property. Connections, variables, events,

    and logging features are available as members of the Dts property as shown in the following examples.

    To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;

    To post a log entry, call Dts.Log("This is my log text", 999, null);

    To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);

    To use the connections collection use something like the following:

    ConnectionManager cm = Dts.Connections.Add("OLEDB");

    cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";

    Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.

    To open Help, press F1.

    */

    public void Main()

    {

    bool failure = false;

    bool fireAgain = true;

    foreach (var ConnMgr in Dts.Connections)

    {

    Dts.Events.FireInformation(1, "", String.Format("ConnectionManager='{0}', ConnectionString='{1}'",

    ConnMgr.Name, ConnMgr.ConnectionString), "", 0, ref fireAgain);

    try

    {

    ConnMgr.AcquireConnection(null);

    Dts.Events.FireInformation(1, "", String.Format("Connection acquired successfully on '{0}'",

    ConnMgr.Name), "", 0, ref fireAgain);

    }

    catch (Exception ex)

    {

    Dts.Events.FireError(-1, "", String.Format("Failed to acquire connection to '{0}'. Error Message='{1}'",

    ConnMgr.Name, ex.Message),

    "", 0);

    failure = true;

    }

    }

    if (failure)

    Dts.TaskResult = (int)ScriptResults.Failure;

    else

    Dts.TaskResult = (int)ScriptResults.Success;

    }

    }

    }