Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy getting following error in SSIS script?
    text
    copied!<p>I have simple script :</p> <pre><code> public void Main() { // TODO: Add your code here Dts.TaskResult = (int)ScriptResults.Success; //MYCode Variables varCollection = null; string DestinationRoot = varCollection("User::DestinationRoot").Value.ToString(); int MonthStartPosition = Convert.ToInt32(varCollection("User::MonthStartPosition").Value); int MonthLength = Convert.ToInt32(varCollection("User::MonthLength").Value); int MonthValue = 0; string MonthNameFormat = varCollection("User::MonthNameFormat").Value.ToString(); string FolderName = string.Empty; string MonthwiseDirectory = string.Empty; if (MonthStartPosition &gt; 0 &amp;&amp; MonthLength &gt; 0) { MonthValue = Convert.ToInt32(FileName.Substring(MonthStartPosition - 1, MonthLength)); } if (FileName.Length &gt; 0 &amp;&amp; MonthValue &gt; 0) { FolderName = new DateTime(1, MonthValue, 1).ToString(MonthNameFormat); } MonthwiseDirectory = System.IO.Path.Combine(DestinationRoot, FolderName); if (!System.IO.Directory.Exists(MonthwiseDirectory)) { System.IO.Directory.CreateDirectory(MonthwiseDirectory); } varCollection("User::DestinationFolder").Value = MonthwiseDirectory; //Error 1 : also getting error here like 'varCollection' is a 'variable' but is used like a 'method' Dts.TaskResult = Dts.Results.Success; //Error 2 } </code></pre> <p>But it gives error like : </p> <blockquote> <p>Error 1 : 'varCollection' is a 'variable' but is used like a 'method' </p> <p>Error 2: 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel' does not contain a definition for 'Results' and no extension method 'Results' accepting a first argument of type 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel' could be found (are you missing a using directive or an assembly reference?) C:\Users\AppData\Local\Temp\SSIS\dfac06a62ee9472bac783737af4957de\ScriptMain.cs 91 34 st_7c1dde41280d4efc996c50fead62bfa9</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload