예제 #1
0
        private void SetComponentProperties(OLEDBSource source)
        {
            switch (source.AccessMode)
            {
            case DataFlowSourceQueryAccessMode.SQLCOMMAND:
                _instance.SetComponentProperty("AccessMode", 2);
                _instance.SetComponentProperty("SqlCommand", source.Body);
                Flush();
                break;

            case DataFlowSourceQueryAccessMode.SQLCOMMANDFROMVARIABLE:
                _instance.SetComponentProperty("AccessMode", 3);

                DTS.Variable sqlCommandVariable = SsisPackage.CurrentPackage.DTSPackage.Variables.Add(
                    ("var" + Guid.NewGuid().ToString()).Replace("-", string.Empty)
                    , false
                    , "User"
                    , string.Empty);
                sqlCommandVariable.EvaluateAsExpression = true;
                sqlCommandVariable.Expression           = source.Body;
                _instance.SetComponentProperty("SqlCommandVariable", sqlCommandVariable.Name);
                Flush();
                break;

            default:
                MessageEngine.Global.Trace(Severity.Error, "Unknown Source Data Access Mode Type of {0}", source.AccessMode);
                break;
            }
        }
예제 #2
0
        public SsisSourceComponent(Transformation t, SSISEmitterContext context)
            : base(t, context)
        {
            OLEDBSource source = (OLEDBSource)t;

            InitializeConnection(source.Connection);
            SetOutputName(source.OutputPath);

            SetComponentProperties(source);
            SetParameterMapping(source.ParameterMappings, SsisPackage.CurrentPackage.DTSPackage.Variables);

            Validate();
        }