我在SSIS脚本任务中包含以下代码,该代码包含在循环中:
public void Main()
{
System.DateTime beginDate = DateTime.Parse(Dts.Variables["User::BeginDate"].Value.ToString());
System.DateTime endDate = beginDate.AddMonths(1);
string strMessage = string.Format("Row count validation failed for the period {0} to {1}. Ods has fewer rows for this period than the source.",
beginDate,
endDate);
Dts.Events.FireError(0, "Row count validation", strMessage, "", 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}
当我在Visual Studio中运行此程序并发生错误时,将触发Error事件,循环终止并且程序包执行停止。当我将其部署到SSIS服务器并运行它时,不会触发错误事件,循环不会终止,程序包也不会终止。有人知道为什么吗?