1

I have a script task that creates and sends email to different users. The code itself works fine when executed in Visual Studio.

But when this code placed in Script Task - it gives me an error:

enter image description here

I found that one of the reasons could be "Main" entry point on script task. But this was already set by default.

enter image description here

Also read that might need some change in Microsoft Header or something, but not sure what is it.

  #region Namespaces
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using System.Data.OleDb;
    using System.Runtime.InteropServices;
    using System.Net.Mail;
    using System.Data.SqlClient;
    using Microsoft.Office.Interop.Excel;
    using System.Security.Policy;
    #endregion

    namespace ST_ff2838a07b8b464fa4f787c388ad3857
    {
        /// <summary>
        /// ScriptMain is the entry point class of the script.  Do not change the name, attributes,
        /// or parent of this class.
        /// </summary>


   //Do I need to change something here???  

//[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
        {


            /// <summary>
            /// This method is called when this script task executes in the control flow.
            /// Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
            /// To open Help, press F1.
            /// </summary>
            public void Main(string[] args)
            {
                string UnderwriterName = "SELECT DISTINCT [Underwriter] FROM [ExcessRenewal].[dbo].[Renewals]";
                string connectionString =
1
  • Did you copy this code in? The namespaces don't match. Commented Sep 14, 2018 at 18:45

1 Answer 1

0

SSIS is looking for the namespace associated with the Project:

ST_......75700c1

but i think you copied in code over it and have a different namespace now:

ST_ff2838a07b8b464fa4f787c388ad3857

just replace the namespace in the script with your project namespace and I think you will be good to go.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried to change namespace to ST_f575df1df9704300ae9d3c0d975700c1 but no success yet.
Start over with a new script task. Paste in your namespace then paste your code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.