[英]SSIS Script Task Error
I'm trying to get this answer working in my package, but I get the below error message on the first line. 我正在尝试使此答案在我的程序包中起作用,但在第一行显示以下错误消息。
Cannot implicitly convert type 'object' to 'string'. 无法将类型'object'隐式转换为'string'。 An explicit conversion exists (are you missing a cast?)
存在显式转换(您是否缺少演员表?)
I also get a warning saying "ex" is declared but never used. 我还收到一条警告,说已声明“ ex”但从未使用过。
Anyone know what I can do to fix this? 有人知道我可以做些什么来解决此问题吗?
string connString = Dts.Variables["User::SQLServer"].Value;
try
{
using (OleDbConnection connection = new OleDbConnection())
{
connection.ConnectionString = connString;
connection.Open();
}
Dts.Variables["User::DatabaseCanConnect"].Value = true;
}
catch (Exception ex)
{
Dts.Variables["User::DatabaseCanConnect"].Value = false;
}
Dts.TaskResult = (int)ScriptResults.Success;
string connString = Dts.Variables["User::SQLServer"].Value.ToString().Trim();
这就是我所需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.