Hi experts,
I'm developing a SSIS package programitically using C#.net, every thing is fine til i acquire the connection, i'm struck here, i'm getting COM exception i.e HRESULT: 0xC020801C, i went through many threads but i could not find any proper solution, so i'm posting this query again, i need the solution badly.
here goes my code...
PipeLineWrapper.CManagedComponentWrapper managedOleInstance = managedOleInstanceDestinationComponent;
// setting the connection
if (destinationComponent.RuntimeConnectionCollection.Count > 0)
{ // If connection is necessary
destinationComponent.RuntimeConnectionCollection[0].ConnectionManagerID =
destinationDatabaseConnectionManager.ID;
destinationComponent.RuntimeConnectionCollection[0].ConnectionManager =
DtsConvert.ToConnectionManager90(destinationDatabaseConnectionManager);
}
// Set the custom properties.
managedOleInstance.SetComponentProperty("AccessMode", 0);
managedOleInstance.SetComponentProperty("AlwaysUseDefaultCodePage", false);
managedOleInstance.SetComponentProperty("DefaultCodePage", 1252);
managedOleInstance.SetComponentProperty("FastLoadKeepIdentity", false);
managedOleInstance.SetComponentProperty("FastLoadKeepNulls", false);
managedOleInstance.SetComponentProperty("FastLoadMaxInsertCommitSize", 0);
managedOleInstance.SetComponentProperty("FastLoadOptions", "TABLOCK,CHECK_CONSTRAINTS");
managedOleInstance.SetComponentProperty("OpenRowset",
string.Format("[{0}].[dbo].[{1}]", DatabaseName, TableName));
// Now activate a connection and create the mappings
// =========================================================================
// Establish a connection
managedOleInstance.AcquireConnections(null); --------------------------> this is the point where i'm getting the exception
// initialize the metadata
managedOleInstance.ReinitializeMetaData();
// Get the destination's default input and virtual input.
PipeLineWrapper.IDTSInput90 input = destinationComponent.InputCollection[0];
PipeLineWrapper.IDTSVirtualInput90 vInput = input.GetVirtualInput();
i'm using csv file as sourece and sql server as destination, sql server is running in the local system here goes my connection string
Data Source=1DTWN0023;Initial Catalog=AdventureWorks;User ID=sa; Password=sa@123
would be very happy to see the response.. thanks in advance
Warm regards
--
murali
I'm developing a SSIS package programitically using C#.net, every thing is fine til i acquire the connection, i'm struck here, i'm getting COM exception i.e HRESULT: 0xC020801C, i went through many threads but i could not find any proper solution, so i'm posting this query again, i need the solution badly.
here goes my code...
PipeLineWrapper.CManagedComponentWrapper managedOleInstance = managedOleInstanceDestinationComponent;
// setting the connection
if (destinationComponent.RuntimeConnectionCollection.Count > 0)
{ // If connection is necessary
destinationComponent.RuntimeConnectionCollection[0].ConnectionManagerID =
destinationDatabaseConnectionManager.ID;
destinationComponent.RuntimeConnectionCollection[0].ConnectionManager =
DtsConvert.ToConnectionManager90(destinationDatabaseConnectionManager);
}
// Set the custom properties.
managedOleInstance.SetComponentProperty("AccessMode", 0);
managedOleInstance.SetComponentProperty("AlwaysUseDefaultCodePage", false);
managedOleInstance.SetComponentProperty("DefaultCodePage", 1252);
managedOleInstance.SetComponentProperty("FastLoadKeepIdentity", false);
managedOleInstance.SetComponentProperty("FastLoadKeepNulls", false);
managedOleInstance.SetComponentProperty("FastLoadMaxInsertCommitSize", 0);
managedOleInstance.SetComponentProperty("FastLoadOptions", "TABLOCK,CHECK_CONSTRAINTS");
managedOleInstance.SetComponentProperty("OpenRowset",
string.Format("[{0}].[dbo].[{1}]", DatabaseName, TableName));
// Now activate a connection and create the mappings
// =========================================================================
// Establish a connection
managedOleInstance.AcquireConnections(null); --------------------------> this is the point where i'm getting the exception
// initialize the metadata
managedOleInstance.ReinitializeMetaData();
// Get the destination's default input and virtual input.
PipeLineWrapper.IDTSInput90 input = destinationComponent.InputCollection[0];
PipeLineWrapper.IDTSVirtualInput90 vInput = input.GetVirtualInput();
i'm using csv file as sourece and sql server as destination, sql server is running in the local system here goes my connection string
Data Source=1DTWN0023;Initial Catalog=AdventureWorks;User ID=sa; Password=sa@123
would be very happy to see the response.. thanks in advance
Warm regards
--
murali