У меня есть сценарий, который создает и отправляет электронную почту различным пользователям.
Сам код прекрасно работает при выполнении в Visual Studio.
Но когда этот код помещают в Script Task - выдает ошибку:
Я обнаружил, что одной из причин может быть «Главная» точка входа в задачу скрипта. Но это уже было установлено по умолчанию.
Также прочитайте, что может потребоваться некоторое изменение в заголовке Microsoft или что-то в этом роде, но не знаете, что это такое.
#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 =