无法在 SQL Data Tools 脚本中应用相等性。
目的:建立一个变量,在不需要做任何事情时用作优雅的退出
错误
"Operator '==' cannot be applied to operands of type 'bool'"
Only assignment, call, increment, decrment, await, and new object expressions can be uses as statement
代码:
String recfil=Dts.Variables["User::FolderPath"].Value.ToString() + Dts.Variables["User::RecfileName"0.Value.ToString();
int recfilExists=Convert.ToInt32(File.Exists(recfil));
bool goodRun = irecfilExists.Equals(1)
bool noRun = irecfilExists.Equals(0)
if (goodRun)
{
Dts.Variables["User::NothingToDo"].Value == goodRun;
Dts.TaskResult = (int)ScriptResults.Success;
}
else
{
Dts.Variables["User::NothingToDo"].Value == noRun;
Dts.TaskResult = (int)ScriptResults.Failure;
}