SSIS:如何通过脚本任务设置初始目录的值
我正在循环连接:
for (int x = 0; x < Dts.Connections.Count; x++)
{
switch (Dts.Connections[x].Name.ToString())
{
case "m":
for (int z = 0; z < Dts.Connections[x].Properties.Count; z++)
{
if ( Dts.Connections[x].Properties[n].Name = "Initial Catalog"){
Dts.Connections[x].Properties[n].SetValue(object o, object value);}
}
break;
}
}
上面是我所得到的,setvalue 的签名是 (Object o, Object value)
i am looping through my connections:
for (int x = 0; x < Dts.Connections.Count; x++)
{
switch (Dts.Connections[x].Name.ToString())
{
case "m":
for (int z = 0; z < Dts.Connections[x].Properties.Count; z++)
{
if ( Dts.Connections[x].Properties[n].Name = "Initial Catalog"){
Dts.Connections[x].Properties[n].SetValue(object o, object value);}
}
break;
}
}
above is as far as i have gotten, the signature of setvalue is (Object o, Object value)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据 SetValue 的文档(),第一个参数是要设置属性的对象,第二个参数是属性值。所以它应该是这样的:
或者使用 LINQ:(
Cast()
是必要的,因为遗憾的是,这些集合不是通用的。)According to the documentation of
SetValue()
, the first parameter is the object on which you want to set the property and the second is the property value. So it should be something like this:Or with LINQ:
(The
Cast()
s are necessary, because the collections are, sadly, not generic.)尝试使用以下命令设置 DTS 连接
Try using the following to setup a DTS Connection