Monday, July 7, 2014

How to call the assigned variables in script task editor

Below is the example of calling declared variables in script task editor. 

string userName = (string)Dts.Variables["User::UserName"].Value;
string password = (string)Dts.Variables["User::Password"].Value; 

Sometimes when we call the datetime variable, we need to convert it to the required format like 'dd-MM-yyyy' or with time, etc. Below is the example:

DateTime FromDate = (DateTime)Dts.Variables["User::FromDate"].Value;
string s = FromDate.ToString("yyyy-MM-dd");
DateTime ToDate = (DateTime)Dts.Variables["User::ToDate"].Value;

string s1 = ToDate.ToString("yyyy-MM-dd");

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.