基于SSIS开发--OLEDB目标组件(三)
创建OLEDB目标组件
// Create and configure an OLE DB destination.
IDTSComponentMetaData100 destination = dataFlowTask.ComponentMetaDataCollection.New();
destination.ComponentClassID = "DTSAdapter.OleDbDestination";
// Create the design-time instance of the destination.
CManagedComponentWrapper destDesignTime = destination.Instantiate();
// The ProvideComponentProperties method creates a default input.
destDesignTime.ProvideComponentProperties();
// Assign the connection manager.
destination.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(conMgr2);
destination.RuntimeConnectionCollection[0].ConnectionManagerID = conMgr2.ID;
// Set the custom properties of the source.
//destDesignTime.SetComponentProperty("AccessMode", 2);
//destDesignTime.SetComponentProperty("SqlCommand", "Select * from sqldb");
destDesignTime.SetComponentProperty("AccessMode", 0);
destDesignTime.SetComponentProperty("AlwaysUseDefaultCodePage", false);
// destDesignTime.SetComponentProperty("DefaultCodePage", 936);
destDesignTime.SetComponentProperty("OpenRowset", "\"用户\".\"表名\"");
destDesignTime.AcquireConnections(null);
destDesignTime.ReinitializeMetaData();
//destDesignTime.ReleaseConnections();

浙公网安备 33010602011771号