/// <summary> /// ctor accepts an ISExecuteSqlTask, result name and variable name /// If a ResultBinding with the same name exists, then that is reused otherwise a new Result Binding is created /// </summary> /// <param name="sqlTask"></param> /// <param name="dtsVariableName"></param> /// <param name="resultName"></param> public ISResultSetBinding(ISExecuteSqlTask sqlTask, string dtsVariableName, object resultName) { bool resultSetExists = false; IEnumerator resultSets = sqlTask.ResultSetBindings_m.GetEnumerator(); while (resultSets.MoveNext()) { IDTSResultBinding resultSet = (resultSets.Current as IDTSResultBinding); if (resultSet.ResultName.ToString() == ResultName.ToString()) { resultSetExists = true; ResultSetBinding = resultSet; } } if (resultSetExists == false) { ResultSetBinding = sqlTask.ResultSetBindings_m.Add(); ResultName = resultName; } DtsVariableName = dtsVariableName; }
/// <summary> /// ctor accepts an ISExecuteSqlTask and various Paramater Binding Properties /// If a ParameterBinding with the passed name exists, then that is used; otherwise a new Parameter Binding is created /// </summary> /// <param name="sqlTask"></param> /// <param name="dataType"></param> /// <param name="dtsVariableName"></param> /// <param name="paramDirection"></param> /// <param name="paramName"></param> /// <param name="paramSize"></param> public ISParameterBinding(ISExecuteSqlTask sqlTask, int dataType, string dtsVariableName, ParameterDirections paramDirection, object paramName, int paramSize) { bool paramExists = false; IEnumerator parameters = sqlTask.ParameterBindings_m.GetEnumerator(); while (parameters.MoveNext()) { IDTSParameterBinding param = (parameters.Current as IDTSParameterBinding); if (param.ParameterName.ToString() == paramName.ToString()) { paramExists = true; ParameterBinding = param; } } if (paramExists == false) { ParameterBinding = sqlTask.ParameterBindings_m.Add(); ParameterName = paramName; } DataType = dataType; DtsVariableName = dtsVariableName; ParameterDirection = paramDirection; ParameterSize = paramSize; }