What is the best way to read system variables from Script Component.
Tried as below: Works fine when is User variable
base.PreExecute();
IDTSVariables100 variables = null;
VariableDispenser.LockForRead("System::ContainerStartTime");
VariableDispenser.GetVariables(out variables);
auditTimeStamp = Convert.ToDateTime(variables[1].Value);
System.Windows.Forms.MessageBox.Show(auditTimeStamp.ToString());
variables.Unlock();
when tried to read System variable throws following error:
Script Component has encountered an exception in user code: Project name: SC_0bfc7da1c6fe4b83bc124b87eb4178e5 Exception from HRESULT: 0xC0010009
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100.get_Item(Object Index) at ScriptMain.PreExecute() at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
any clues please.
Thanks