April 20, 2012 at 11:37 am
Is it to set a WMI DataReader task to fail if the query does not return any rows. For example:
select * from CIM_Datafile where Drive = 'K:' and path = '\\projects\\'
if this query returns 0 rows
Thanks
April 20, 2012 at 2:46 pm
AIRWALKER-375999 (4/20/2012)
Is it to set a WMI DataReader task to fail if the query does not return any rows. For example:select * from CIM_Datafile where Drive = 'K:' and path = '\\projects\\'
if this query returns 0 rows
Thanks
One way to do it would be to pipe your WMI Data Reader output into a variable of type String, let's call it VariableName. From your WMI Data Reader you could go to a Script Task and check the length of the string. If the string is empty it means you have no files, else you found one or more.
Here would be code from Main() in the Script Task:
public void Main()
{
if (string.IsNullOrEmpty(Dts.Variables["VariableName"].Value.ToString()))
Dts.TaskResult = (int)ScriptResults.Failure;
else
Dts.TaskResult = (int)ScriptResults.Success;
}
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply