I'm not sure why this happens, but my script task is not storing a DateTime-Value in a variable. This is the (till now) very basic code I've written:
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
public void Main()
{
DateTime creationTime;
DateTime modifiedTime;
DateTime oldCreationDate = (DateTime)Dts.Variables["User::OldFileDate"].Value;
DateTime oldModifiedTime = (DateTime)Dts.Variables["User::OldModifiedDate"].Value;
Dts.Variables["User::OldFileDate"].Value = DateTime.Now;
Dts.TaskResult = (int)ScriptResults.Success;
}
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
}
It's not done yet, but I wanted to check if the variable is stored or not. I checked the variables using the debugger, during runtime the varible changes, but if I look at the variable after the execution it is still the same value.
I also checked the properties and ReadOnly
is False
and the Variables are also added to the package.
Any Ideas on what I am doing wrong?