protected override void Setup(SetupContext context)
        {
            DtsVariable custSrc = context.Package.GetVariableForPath(@"\[CopyCustomers4].[SourcePath]");

            custSrc.SetValue(Constants.CustomersFileSource);

            DtsVariable custDest = context.Package.GetVariableForPath(@"\[CopyCustomers4].[DestinationPath]");

            custDest.SetValue(Constants.CustomersFileDestination);

            DtsVariable custDestNew = context.Package.GetVariableForPath(@"\[CopyCustomers4].[ConvertDestinationPath]");

            custDestNew.SetValue(Constants.CustomersFileConverted);

            DtsVariable variable = context.Package.GetVariableForPath(@"\[CopyCustomers4]\[DFT Convert customer names].[CustomerCount]");

            variable.SetValue(0);

            DtsConnection newCustomersConnection = context.Package.GetConnection("New Customers Src");

            newCustomersConnection.SetConnectionString(Constants.CustomersNewFileSource);

            DtsConnection productConnection = context.Package.GetConnection("Products Src");

            productConnection.SetConnectionString(Constants.ProductsFileSource);
        }
Esempio n. 2
0
        internal DataSet GetGridViewData(string strPath)
        {
            string        dtexecArgs;
            string        dataReaderName;
            DtsConnection dtsConnection;
            DtsCommand    dtsCommand;

            DataSet     dsPackageData = new DataSet();
            IDataReader dtsDataReader;

            dtexecArgs = string.Format("-f \"{0}\"", strPath);

            dataReaderName = "DataReaderDest";
            dtsConnection  = new DtsConnection();
            dtsConnection.ConnectionString = dtexecArgs;
            dtsCommand             = new DtsCommand(dtsConnection);
            dtsCommand.CommandText = dataReaderName;
            dtsConnection.Open();
            dtsDataReader = dtsCommand.ExecuteReader(CommandBehavior.Default);

            dsPackageData.Load(dtsDataReader, LoadOption.OverwriteChanges, dtsDataReader.GetSchemaTable().TableName);

            try
            {
                if (dtsDataReader != null)
                {
                    dtsDataReader.Close();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(
                    string.Format("Exception closing DataReader: {0}{1}", e.InnerException.Message, Environment.NewLine),
                    "Exception closing connection",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            }
            return(dsPackageData);
        }