예제 #1
0
        public override IDTSComponentMetaData100 AddDestAdapter(IDTSPipeline100 pipeline, ConnectionManager destConnMgr, out IDTSDesigntimeComponent100 destDesignTimeComp)
        {
            if (String.IsNullOrEmpty(quotedTableName))
            {
                throw new ArgumentException("Destination table name is empty");
            }
            IDTSComponentMetaData100 destComp = pipeline.ComponentMetaDataCollection.New();

            destComp.ComponentClassID         = OLEDB_DEST_GUID;
            destComp.ValidateExternalMetadata = true;
            destDesignTimeComp = destComp.Instantiate();
            destDesignTimeComp.ProvideComponentProperties();
            destComp.Name = "OleDB Destination - Sql Server";
            destDesignTimeComp.SetComponentProperty("AccessMode", 0);
            destDesignTimeComp.SetComponentProperty("OpenRowset", quotedTableName);

            // set connection
            destComp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(destConnMgr);
            destComp.RuntimeConnectionCollection[0].ConnectionManagerID = destConnMgr.ID;

            // get metadata
            destDesignTimeComp.AcquireConnections(null);
            destDesignTimeComp.ReinitializeMetaData();
            destDesignTimeComp.ReleaseConnections();

            extCols = destComp.InputCollection[0].ExternalMetadataColumnCollection;

            return(destComp);
        }
예제 #2
0
        public override IDTSComponentMetaData100 AddDestAdapter(IDTSPipeline100 pipeline, ConnectionManager destConnMgr, out IDTSDesigntimeComponent100 destDesignTimeComp)
        {
            IDTSComponentMetaData100 destComp = pipeline.ComponentMetaDataCollection.New();

            destComp.ComponentClassID         = EXCEL_DEST_GUID;
            destComp.ValidateExternalMetadata = true;
            destDesignTimeComp = destComp.Instantiate();
            destDesignTimeComp.ProvideComponentProperties();
            destComp.Name = "OleDB Destination - Excel";
            destDesignTimeComp.SetComponentProperty("AccessMode", 0);
            // OleDb provider does not recognize OpenRowSet name quoted with `
            destDesignTimeComp.SetComponentProperty("OpenRowset", UnquotedSheetName);

            // set connection
            destComp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(destConnMgr);
            destComp.RuntimeConnectionCollection[0].ConnectionManagerID = destConnMgr.ID;
            // get metadata
            destDesignTimeComp.AcquireConnections(null);
            destDesignTimeComp.ReinitializeMetaData();
            destDesignTimeComp.ReleaseConnections();
            extCols = destComp.InputCollection[0].ExternalMetadataColumnCollection;
            return(destComp);
        }
        private void CopyFlatFileColumns(ConnectionManager conn, IDTSDesigntimeComponent100 designtimeComponent)
        {
            int codePage = (int)conn.Properties["CodePage"].GetValue(conn);
            IDTSConnectionManagerFlatFileColumns100 columns = conn.Properties["Columns"].GetValue(conn) as IDTSConnectionManagerFlatFileColumns100;

            if (columns.Count > 1)
            {
                designtimeComponent.SetComponentProperty(PropertiesManager.ColumnDelimiterPropName, columns[0].ColumnDelimiter);
            }
            if (columns.Count > 0)
            {
                designtimeComponent.SetComponentProperty(PropertiesManager.RowDelimiterPropName, columns[columns.Count - 1].ColumnDelimiter);
            }

            int           columnIndex = 0;
            IDTSOutput100 mainOutput  = GetMainOutput();

            foreach (IDTSConnectionManagerFlatFileColumn100 column in columns)
            {
                AddColumn(designtimeComponent, column, mainOutput.ID, columnIndex, codePage);
                columnIndex++;
            }
        }
        private void TransferConnectionMetadata(ConnectionManager conn)
        {
            IDTSDesigntimeComponent100 designtimeComponent = this.componentMetadata.Instantiate();

            this.componentMetadata.LocaleID = (int)conn.Properties["LocaleID"].GetValue(conn);
            designtimeComponent.SetComponentProperty(PropertiesManager.IsUnicodePropName, conn.Properties["Unicode"].GetValue(conn));
            designtimeComponent.SetComponentProperty(PropertiesManager.CodePagePropName, conn.Properties["CodePage"].GetValue(conn));
            designtimeComponent.SetComponentProperty(PropertiesManager.ColumnNamesInFirstRowPropName, conn.Properties["ColumnNamesInFirstDataRow"].GetValue(conn));
            designtimeComponent.SetComponentProperty(PropertiesManager.HeaderRowDelimiterPropName, conn.Properties["HeaderRowDelimiter"].GetValue(conn));
            designtimeComponent.SetComponentProperty(PropertiesManager.HeaderRowsToSkipPropName, conn.Properties["HeaderRowsToSkip"].GetValue(conn));
            designtimeComponent.SetComponentProperty(PropertiesManager.DataRowsToSkipPropName, conn.Properties["DataRowsToSkip"].GetValue(conn));
            designtimeComponent.SetComponentProperty(PropertiesManager.TextQualifierPropName, conn.Properties["TextQualifier"].GetValue(conn));

            CopyFlatFileColumns(conn, designtimeComponent);
        }
예제 #5
0
        public override IDTSComponentMetaData100 AddDestAdapter(IDTSPipeline100 pipeline, ConnectionManager destConnMgr, out IDTSDesigntimeComponent100 destDesignTimeComp)
        {
            IDTSComponentMetaData100 destComp = pipeline.ComponentMetaDataCollection.New();

            destComp.ComponentClassID         = FLATFILE_DEST_GUID;
            destComp.ValidateExternalMetadata = true;
            destDesignTimeComp = destComp.Instantiate();
            destDesignTimeComp.ProvideComponentProperties();
            destComp.Name = "Flat File Destination";
            destDesignTimeComp.SetComponentProperty("Overwrite", true);

            // set connection
            destComp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(destConnMgr);
            destComp.RuntimeConnectionCollection[0].ConnectionManagerID = destConnMgr.ID;

            // get metadata
            destDesignTimeComp.AcquireConnections(null);
            destDesignTimeComp.ReinitializeMetaData();
            destDesignTimeComp.ReleaseConnections();
            return(destComp);
        }
예제 #6
0
        public override IDTSComponentMetaData100 AddDestAdapter(IDTSPipeline100 pipeline, ConnectionManager destConnMgr, out IDTSDesigntimeComponent100 destDesignTimeComp)
		{
			IDTSComponentMetaData100 destComp = pipeline.ComponentMetaDataCollection.New();
			destComp.ComponentClassID = EXCEL_DEST_GUID;
			destComp.ValidateExternalMetadata = true;
			destDesignTimeComp = destComp.Instantiate();
			destDesignTimeComp.ProvideComponentProperties();
			destComp.Name = "OleDB Destination - Excel";
			destDesignTimeComp.SetComponentProperty("AccessMode", 0);
            // OleDb provider does not recognize OpenRowSet name quoted with ` 
            destDesignTimeComp.SetComponentProperty("OpenRowset", UnquotedSheetName);

			// set connection
			destComp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(destConnMgr);
			destComp.RuntimeConnectionCollection[0].ConnectionManagerID = destConnMgr.ID;
			// get metadata
			destDesignTimeComp.AcquireConnections(null);
			destDesignTimeComp.ReinitializeMetaData();
			destDesignTimeComp.ReleaseConnections();
            extCols = destComp.InputCollection[0].ExternalMetadataColumnCollection;
            return destComp;
		}
예제 #7
0
        public override IDTSComponentMetaData100 AddDestAdapter(IDTSPipeline100 pipeline, ConnectionManager destConnMgr, out IDTSDesigntimeComponent100 destDesignTimeComp)
        {
            IDTSComponentMetaData100 destComp = pipeline.ComponentMetaDataCollection.New();
            destComp.ComponentClassID = FLATFILE_DEST_GUID;
            destComp.ValidateExternalMetadata = true;
            destDesignTimeComp = destComp.Instantiate();
            destDesignTimeComp.ProvideComponentProperties();
            destComp.Name = "Flat File Destination";
            destDesignTimeComp.SetComponentProperty("Overwrite", true);

            // set connection
            destComp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(destConnMgr);
            destComp.RuntimeConnectionCollection[0].ConnectionManagerID = destConnMgr.ID;

            // get metadata
            destDesignTimeComp.AcquireConnections(null);
            destDesignTimeComp.ReinitializeMetaData();
            destDesignTimeComp.ReleaseConnections();
            return destComp;
        }
예제 #8
0
        public override IDTSComponentMetaData100 AddDestAdapter(IDTSPipeline100 pipeline, ConnectionManager destConnMgr, out IDTSDesigntimeComponent100 destDesignTimeComp)
        {
            if (String.IsNullOrEmpty(quotedTableName))
            {
                throw new ArgumentException("Destination table name is empty");
            }
            IDTSComponentMetaData100 destComp = pipeline.ComponentMetaDataCollection.New();
            destComp.ComponentClassID = OLEDB_DEST_GUID;
            destComp.ValidateExternalMetadata = true;
            destDesignTimeComp = destComp.Instantiate();
            destDesignTimeComp.ProvideComponentProperties();
            destComp.Name = "OleDB Destination - Sql Server";
            destDesignTimeComp.SetComponentProperty("AccessMode", 0);
            destDesignTimeComp.SetComponentProperty("OpenRowset", quotedTableName);

            // set connection
            destComp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(destConnMgr);
            destComp.RuntimeConnectionCollection[0].ConnectionManagerID = destConnMgr.ID;

            // get metadata
            destDesignTimeComp.AcquireConnections(null);
            destDesignTimeComp.ReinitializeMetaData();
            destDesignTimeComp.ReleaseConnections();

            extCols = destComp.InputCollection[0].ExternalMetadataColumnCollection;

            return destComp;
        }
        private void CopyFlatFileColumns(ConnectionManager conn, IDTSDesigntimeComponent100 designtimeComponent)
        {
            int codePage = (int)conn.Properties["CodePage"].GetValue(conn);
            IDTSConnectionManagerFlatFileColumns100 columns = conn.Properties["Columns"].GetValue(conn) as IDTSConnectionManagerFlatFileColumns100;

            if (columns.Count > 1)
            {
                designtimeComponent.SetComponentProperty(PropertiesManager.ColumnDelimiterPropName, columns[0].ColumnDelimiter);
            }
            if (columns.Count > 0)
            {
                designtimeComponent.SetComponentProperty(PropertiesManager.RowDelimiterPropName, columns[columns.Count - 1].ColumnDelimiter);
            }

            int columnIndex = 0;
            IDTSOutput100 mainOutput = GetMainOutput();

            foreach (IDTSConnectionManagerFlatFileColumn100 column in columns)
            {
                AddColumn(designtimeComponent, column, mainOutput.ID, columnIndex, codePage);
                columnIndex++;
            }
        }