how to get external variable value in dtsx package.

Posted by Rishabh on Stack Overflow See other posts from Stack Overflow or by Rishabh
Published on 2010-04-05T07:09:37Z Indexed on 2010/04/05 7:13 UTC
Read the original article Hit count: 254

Filed under:
|

Hi,

I am executing .dtsx package from c#, it was executing fine, if i am passing one variable value from c# code then how can i get it on .dtsx package for my ole db source query. Here is my c# code.

            string file = @"D:\CYNCZFuzzy\CYNCZFuzzy\Contact.dtsx";
           package = app.LoadPackage(file, null);
           Variables vars = package.Variables;
           vars["User::parentContactID"].Value = 1028203;
           pkgResults = package.Execute();
           string result = pkgResults.ToString();

I need this 1028203 value on my ole db source query, here my query.

select  cr.MasterContactID as ParentContactID, 
        c.ID,C.FirstName, 
        C.MiddleName, 
        c.LastName, 
        c.ID as FieldID 
from    Contact c inner join 
        ContactRelation cr on cr.SlaveContactID = c.ID 
where   RelationshipID = 1 
AND     cr.MasterContactID = ?

what I should write on ? for getting 1028203 value from c# page.

Thanks in advance...

© Stack Overflow or respective owner

Related posts about ssis

Related posts about sql-server