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:
I found that one of the reasons could be "Main" entry point on script task. But this was already set by default.
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 =

