creating ssis package using C#.net
-
Hi friends I have created a package using C#.net myPackage.PackageType = DTSPackageType.DTSDesigner90; myPackage.Name = "MySSISPackage"; myPackage.Description = "Created using the SSIS API"; myPackage.CreatorComputerName = System.Environment.MachineName; myPackage.CreatorName = "Otey"; //Add the OLE DB and Flat File Connection Managers Console.WriteLine("Creating the MyOLEDBConnection"); cnOLEDB = myPackage.Connections.Add("OLEDB"); cnOLEDB.Name = "MyOLEDBConnection"; cnOLEDB.ConnectionString = "Data Source=RELL;Initial Catalog=Northwind;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;"; //cnOLEDB.ProtectionLevel = DTSProtectionLevel.EncryptAllWithPassword; Console.WriteLine("Creating the MyFlatFileConnection"); cnDestination = myPackage.Connections.Add("OLEDB"); cnDestination.Name = "cnDestination"; cnDestination.ConnectionString = "Data Source=RELL;Initial Catalog=testssis;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;"; Console.WriteLine("Adding a Data Flow Task"); TaskHost taskDF = myPackage.Executables.Add("DTS.Pipeline") as TaskHost; taskDF.Name = "DataFlow"; DTP = default(MainPipe); DTP = taskDF.InnerObject as MainPipe; // Add the OLE DB Source Console.WriteLine("Adding an OLEDB Source"); DFSource = default(IDTSComponentMetaData90); DFSource = DTP.ComponentMetaDataCollection.New(); DFSource.ComponentClassID = "DTSAdapter.OLEDBSource"; DFSource.Name = "OLEDBSource"; CManagedComponentWrapper SourceInst = DFSource.Instantiate(); SourceInst.ProvideComponentProperties(); DFSource.RuntimeConnectionCollection[0].ConnectionManagerID = myPackage.Connections["MyOLEDBConnection"].ID; DFSource.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(myPackage.Connections["MyOLEDBConnection"]); SourceInst.SetComponentProperty("OpenRowset", "Categories"); SourceInst.SetComponentProperty("AccessMode", 2); SourceInst.AcquireConnections(null); SourceInst.ReinitializeMetaData(); // Error line SourceInst.ReleaseConnections(); I am getting an exception "Exception from HRESULT: