【发布时间】:2018-09-13 16:55:23
【问题描述】:
我有一个脚本任务,可以创建电子邮件并将其发送给不同的用户。 在 Visual Studio 中执行时,代码本身可以正常工作。
但是当这段代码放在脚本任务中时 - 它给了我一个错误:
我发现原因之一可能是脚本任务的“主要”入口点。但这已经默认设置了。
还阅读了可能需要对 Microsoft Header 或其他内容进行一些更改,但不确定是什么。
#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 =
【问题讨论】:
-
你把这段代码复制进去了吗?命名空间不匹配。
标签: c# ssis script-task