Re: Modify SSIS package programmatically
- From: "Francois Malgreve" <francois.malgreve@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 25 Jan 2006 18:11:35 +0700
OOPS I am using SQL 2005 SSIS and when I wrote DTS packge I should have
written IS Package...
Thhank you for your answer and sorry for the mistake.
Anyway I found the solution for SSIS and if you anyone is interested, here
is the an exploded version of the code I used:
(I guess it's easier to understand the object model with the exploded
version of the code)
Microsoft.SqlServer.Dts.Runtime.Connections packageConnections =
package.Connections; // package is a Microsoft.SqlServer.Dts.Runtime.Package
object
Microsoft.SqlServer.Dts.Runtime.ConnectionManager packageExcelConnection =
packageConnections["Excel Connection Manager"]; // name of the Excel
connection or u can use an index instead
Microsoft.SqlServer.Dts.Runtime.DtsProperties connectionProperties =
packageExcelConnection.Properties;
Microsoft.SqlServer.Dts.Runtime.DtsProperty connectionExcelFilePathProp =
connectionProperties["ExcelFilePath"];
connectionExcelFilePathProp.SetValue(packageExcelConnection, "C:\DG.xls");
Best regards,
Francois.
"Darren Green" <darren.green@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uRakCLSIGHA.2212@xxxxxxxxxxxxxxxxxxxxxxx
> Francois Malgreve wrote:
>> Hi All,
>>
>> I have a DTS package that I launch from a C# application.
>> The DTS package contains an Excel Connection. AS the location of the
>> Excel file can change dynamically, I need to be able to change the value
>> of the Excel Connection's "ExcelFilePath" property from my piece of C#
>> code.
>>
>> The problem is that I don't know how to access ExcelFilePath from the C#
>> code.
>> I have seen a class
>> Microsoft.SqlServer.Dts.Runtime.Wrapper.ConnectionManagerExcelClass that
>> has a "ExcelFilePath" prperty but the doc says : This class supports the
>> SQL Server 2005 infrastructure and is not intended to be used directly
>> from your code. Also I don't know how to get an instance from it.
>>
>> I can get an instance of the class
>> Microsoft.SqlServer.Dts.Runtime.ConnectionManager but that class is a
>> generic class for every connection managers and does not have a
>> ExcelFilePath property.
>>
>> Is there anyone who knows how I can change that property from an external
>> piece of code?
>>
>> Thanks in advance,
>>
>> Best regards,
>>
>> Francois Malgreve.
>>
>>
>
> The Microsoft.SqlServer.Dts.Runtime stuff is all SQL 2005, so no good
> whatsoever for DTS.
>
> To change the file path set the DataSource property of the connection
> object.
>
> oPkg.Connections(0).DataSource = "C:\DG.xls"
>
>
> --
> Darren
> http://www.sqldts.com
> http://www.sqlis.com
.
- References:
- Modify SSIS package programmatically
- From: Francois Malgreve
- Re: Modify SSIS package programmatically
- From: Darren Green
- Modify SSIS package programmatically
- Prev by Date: sql server 2000, inport/export, views & UDF
- Next by Date: Re: sql server 2000, inport/export, views & UDF
- Previous by thread: Re: Modify SSIS package programmatically
- Next by thread: Changing source column at row by row base
- Index(es):
Relevant Pages
|