Sql SSIS动态连接管理器验证错误
我想在运行时更改ssis中的连接管理器连接,以便它使用connectionstring进行连接并给出结果。但它给了我这个错误 我已将数据流任务的延迟验证属性设置为falseSql SSIS动态连接管理器验证错误,sql,sql-server-2008,ssis,business-intelligence,Sql,Sql Server 2008,Ssis,Business Intelligence,我想在运行时更改ssis中的连接管理器连接,以便它使用connectionstring进行连接并给出结果。但它给了我这个错误 我已将数据流任务的延迟验证属性设置为false Error: 0xC0202009 at Package, Connection manager "LHRPC-00916.fnp_scenter_test": SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code
Error: 0xC0202009 at Package, Connection manager "LHRPC-00916.fnp_scenter_test": SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
Error: 0xC020801C at Data Flow Task, OLE DB Source [1]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "LHRPC-00916.fnp_scenter_test" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed.
Error: 0xC0047017 at Data Flow Task, SSIS.Pipeline: component "OLE DB Source" (1) failed validation and returned error code 0xC020801C.
Error: 0xC004700C at Data Flow Task, SSIS.Pipeline: One or more component failed validation.
Error: 0xC0024107 at Data Flow Task: There were errors during task validation.
控制流程图
数据流图
动态连接管理器我有两个,一个是静态的,另一个是动态的。为此,请使用ADO.NET管理的连接。我有一个类似的情况,只是创建了第二个连接管理器,其参数与OLE DB相同 另外,不要在脚本任务中更改连接字符串,而是参数化连接管理器(右键单击\参数化)。如果需要多组参数,请使用多个连接管理器 使用托管连接管理器,您可以通过以下方式在代码中打开连接:
SqlConnection GetConnection(string ConnMgrName)
{
ConnectionManager cm = Dts.Connections[ConnMgrName];
SqlConnection conn = (SqlConnection)cm.AcquireConnection(null);
return conn;
}
在脚本任务中编写了以下脚本
public void CheckConnectionString()
{
try
{
if (Dts.Connections["DynamicConnection"] != null)
{
ConnectionManager ConMGr = Dts.Connections["DynamicConnection"];
ConMGr.AcquireConnection(null);
Dts.Variables["ConnectionAvailable"].Value = true;
}
}
catch (Exception ex)
{
Dts.Variables["ConnectionAvailable"].Value = false;
Dts.Variables["ErrorDescription"].Value = ex.Message;
}
finally
{
Dts.TaskResult = (int)ScriptResults.Success;
}
}
添加了优先约束条件
您的屏幕截图很有帮助,但是如果麻烦的元素是连接管理器上的表达式,您是否也可以显示连接管理器、其表达式和变量?此外,每个容器的
Foreach
选项卡可能会亮起,StackOvererFlow的可能副本不起作用。我试了将近24小时。添加评论,但没有任何用处。请回复