Trying to access ReadWrite and ReadOnly variables in Script Component's ProcessInputRow
-
Hi All, I am trying to access PackageLevel variables inside my Script Components ProcessInputRow event of my SSIS package, but Its giving me following error
An exception of type 'Microsoft.SqlServer.Dts.Pipeline.ReadWriteVariablesNotAvailableException' occurred in Microsoft.SqlServer.TxScript.dll but was not handled in user code
Additional information: The collection of variables locked for read and write access is not available outside of PostExecute.
And my code is as below.
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
IDTSVariables100 vars = null;
VariableDispenser.LockForRead("System::TaskName");
VariableDispenser.GetVariables(out vars);
string TaskName = vars["System::TaskName"].Value.ToString();
vars.Unlock();var watcherDBConnectionString = "Data Source=" + Variables.TargetServer01.ToString() + ";Initial Catalog=" + Variables.WatcherDB.ToString() + ";" + Variables.Security.ToString(); var ErrorLogStoredProcedure = ReadOnlyVariables\["ErrorLogStoredProcedure"\].Value.ToString(); int PriorityToBeLogged = (int)Priority.Debug; Log(Variables.PackageName.ToString(), "", "", "ScriptMain", "Main", "Row.FileName : " + Row.FileName + ", Row.File.Length : " + Row.File.Length.ToString(), "ABDUL" , Priority.LogicalError, PriorityToBeLogged, watcherDBConnectionString.ToString(), ErrorLogStoredProcedure.ToString()); }
Can anybody please help me in this? Any code snippet, a link or even a suggestion would help, can't I access or assign the Variables in the ProcessInputRow event of Script Component?
Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."