.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Programmatic SSIS: reading Connection Type Specific Connection Manager properties

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :Sql Server


I'm trying to read Connection Manager properties, but am stumbling when trying to access anything  beyond the generic ConnectionManager objects. In it's stripped down format the code i'm using to read a Property is this:

string InputProperty = string.Empty;

PropertyInfo PropInfo = null;     // Uses System.Reflection to get property info

foreach (ConnectionManager v in package.Connections)


	PropInfo = typeof(ConnectionManager).GetProperty(InputProperty);



However if i'm trying to read an input property that's specific to a type of connection manager, e.g. Flat File Connection manager property HeaderRowsToSkip, the above code fails as the ConnectionManager object only serves up a few generic properties.

Now, I assume that I need to cast or similar to get the IDTSConnectionManagerFlatFile Connection type...  but at this point I get lost. Can anybody give me a helpful pointer?

Cheers, James

James Beresford @ www.bimonkey.com
SSIS / MSBI Consultant in Sydney, Aust

View Complete Post

More Related Resource Links

SSIS Excel Connection Manager Data Type Conversion Issues with SS Agent Job

Hi All! I have an issue I've been trying to fix but can't seem to figure it out. I was hoping a kind person would point me in the right direction. :o) I have an SSIS package that uses an excel connection manager source, and I want to run this package through a job scheduled in the SQL server agent. The data types for the excel file fields are 2 (DT_WSTR) and 5 (DT_R8). When I run the package directly through the SSIS package (VS solution) all of the data fields are properly imported into the database table. But...when I run this package through the SQL server agent job, ONLY the string (DT_WSTR) fields in each row are being imported, all of the float fields are imported as NULL. I set the data types for these float fields as "float" in the SQL server import table (data type). Even though the excel source float fields are indicating a type of DT_R8 in the excel connection manager and I set the data types in the SQL server table to "float", I also used the data conversion component and set the type to "float" as a fail-safe. I guess I should add to that the data access mode in the excel connection manager is using a custom code to select only those columns that I needed and to trim rows that I didn't need. Here's my code that I have in the excel source editor: select f1, f2, f3, f5, f6, f7, f8 from [mdo$] where f2 <> 'Rep Name'

FTP connection manager Editor in ssis

i am using ftp connection manager on my local system.i passed user name as localhost,port number as 21,user name as anonymous,password blank mean nothing.when i test the connection,it give me error as follow,beside i have also provide values for credentials. TITLE: Microsoft Visual Studio ------------------------------ Connection can not be established. Server name, port number, or credentials may be invalid. ------------------------------

SSIS Connection Manager name




Does anyone know how I can get the name of the connection in an ssis package using the package or connections object in c# code?

Custom Connection Manager -- how to use in SSIS 2008 R2 without a DataReader source?


We have a custom connection manager in an SSIS 2005 package. We're able to click on "New Connection" in the Connection Manager section of the data flow task, and see the connection manager in the list. But how do we leverage this new custom connection manager as a source? The DataReader source doesn't seem to be an option anymore. We can't seem to create a new data flow task using this new connection manager as a source.

Ironically, the package runs as is after conversion from 2005 to 2008. It's just that we can't change it or add new data flow tasks using this new connection manager as a source.

Steve Coleman

SSIS --> Code: 0xC0202070 Source: EnrollmentExport Connection manager "V_FlatFileConn" Descrip


I have a SSIS package which is run by Active bactch job daily morning and generate the three text file at different network location. But the sometime the package is failing during the execution with following error message.

" <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-alt:"Calisto MT"; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman";} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; m

Can we import data from Green plum to SQL Server 2005 using OLEDB connection manager in SSIS



actually we are planning to move data from GreenPLum data base to SqlServer 2005 data base using SSIS as ETL tool. What type of connection manager can we use. Is to good to use OLEDB connection manager or ODBC connection manager.

Please give me a reply as soon as possible.




Going Places: How Connection Manager Connects


Marcus Perryman explains the correct use of Connection Manager when a Windows Mobile application requires network data.

Marcus Perryman

MSDN Magazine December 2008

Excel Connection Manager Problem

I am building a package that has 2 tasks that need to use the same excel connection manager. I use a execute sql task to dynamically build a table from the headers of the excel sheet  ,then I use an excel source component to load the data from the sheet. However when I try to edit the excel source and switch the data access mode to a variable and select the variable(for the path), when I try to close the editor I get this message 'S:\myfolder'.  It is already opened exclusively by another user, or you need permission to view its data. I need this package to access the same folder each time because the files will be placed in that folder. This package also has a branch for loading a text file into sql server. It access the same folder but uses a flatfile connection manager It looks like permissions on the folder are correct

Instance and Default connection properties on SQL Server 2005

We had a sql server fail and I have been having troubles.  I compared the connection properties on the server properties and noticed that multiple default settings are no longer set.  So I'm wondering if during the failure these could have some gotten flipped.  DB's that worked all of a sudden don't work and we had to migrate to a different instance.  I have never changed any of the setings below and wonder what impact they would have if I changed them back to the default of an installed instance? ansi warning is checked ansi padding is checked ANSI NULLS is checked arithmetic abort is checked quoted identified is checked No Count is checked concat null yields null is checked Could anyone tell me how clearing these checked options will impact my db?   -- Paul Bergson MVP - Directory Services MCITP: Enterprise Administrator MCTS, MCT, MCSE, MCSA, Security+, BS CSci 2008, Vista, 2003, 2000 (Early Achiever), NT4 http://www.pbbergs.com    Twitter @pbbergs Please no e-mails, any questions should be posted in the NewsGroup This posting is provided "AS IS" with no warranties, and confers no rights.

SQL Server Configuration Manager: Connection to target machine could not be made in a timely fashion

I have a SQL Server 2005 box that was moved from a domain environment to a non-domain environment and was never dropped from its original domain before moving over.  Subsequently a new domain was created at the data center this SQL Server box now resides in.  The machine was dropped from its old domain and joined to the new one.   All the while the service accounts were set to the local admin account.  When I tried to start the Configuration Manager I got the message "Connection to target machine could not be made in a timely fashion.".  I read some blog entries and tried changing all the service accounts to Local System and the error message still came up.   All of the SQL Server services run fine.  It is just this management console that I cannot open.  I wasn't with this employer when this box was moved to the data center so I do not know if it worked prior and there isn't anyone here that could give me its history.   Any help would be appreciated.

errorCode=-1073573417 description=No connection manager is specified.

Hi again,It's me once again trying to migrate a dabatabase from SQL 2000 to SQL 2008 x64. During the migration of one of my databases I get the following error:OnError,LISSQLTEST3,SQLServices,LISSQLTEST2_LISSQLTEST3_Transfer Objects Task,{3CF1D4C8-28CB-4B82-B405-A261E0A173BE},{221EA3F0-32E2-412D-BFDE-76AD1D1715A0},16/08/2009 11:53:07,16/08/2009 11:53:07,0,0x,ERROR : errorCode=-1073573417 description=No connection manager is specified. helpFile= helpContext=0 idofInterfaceWithError={C81DFC5A-3B22-4DA3-BD3B-10BF861A7F9C}StackTrace:    at Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()   at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()   at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()OnError,LISSQLTEST3,SQLServices,CDW_LISSQLTEST2_LISSQLTEST3_15(atashtiot),{E47ED1C2-0D25-48D2-9B4F-14A5DAF96F0A},{221EA3F0-32E2-412D-BFDE-76AD1D1715A0},16/08/2009 11:53:07,16/08/2009 11:53:07,0,0x,ERROR : errorCode=-1073573417 description=No connection manager is specified. helpFile= helpContext=0 idofInterfaceWithError={C81DFC5A-3B22-4DA3-BD3B-10BF861A7F9C}StackTrace:    at Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()   at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()   at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsi

Can not get excel connection when calling an SSIS package from ASP

I have an SSIS package importing data from excel. I have coded it and deployed it on the sql 2008 server. I then execute it via a stored procedure with the following: select @cmd = 'C:\"Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\DTExec.exe" /sq "HRIS"' select   @cmd = @cmd + ' /SET \Package.Variables[User::path].Properties[Value];"' + @path + '"' exec   @rtn = master..xp_cmdshell @cmd   This works fine when  i execute it on my local machine. But when I try to call this Stored proc from my asp app (classic asp, not .net) I get the error: Code: 0xC0202009 Source: HRIS Connection manager "SourceConnectionExcel" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Unspecified error". End Error   Any help would be greatly apprecitated

Connect to an existing connection manager from within a custom transformation?

I'm developing a custom data flow transformation and have hit a roadblock.  I need to create an ADO connection to one of the connection managers that's defined in the package already.  I can either hardcode the name of the connection manager, or define it as a custom property....the problem I'm having is accessing it at all.  What I've found is that ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager only has the connection managers defined by the component itself, not already existing in the package.  How do I create a connection to a connection manager that's defined at the package level at design time? Thanks

Error handling on Connection Manager Expression

I am using a connection manager with an expression to set the connection string. (see my question http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/1ea71f9a-df5c-4c1c-a2fd-9e24632afbd8) I would like to put some error handling just incase things go wrong. Can anybody give me some tips on where to place error handling?Mr Shaw

SSIS Connection Configuration

Hello,   I have a bunch of packages that use different connections. I would like to put all these connections in the a sql config file and use only the needed connections for that package when executing. Right now when I run a package that doesn't use all the connections in the config table I get errors for all the other connections.   I would like to keep all the connections in one table for easy management, is this possible and even if the package does not use all the connections.   THanks, J

FTP connection manager

Hello, Does anyone know if SSIS supports SSH/SFTP connection? I have an FTP connection manager and I cannot seem to connect. I find it odd that SSIS doesn't ask for the connection. Any help would be appreciated and thank you all in advance.   DaveDave SQL Developer

A network-related or instance-specific error occurred while establishing a connection to SQL Server.

I know what the problem is. I am just not sure how to fix it. I get the error below when I have this: < roleManager enabled="true" />  It works fine when I set rolemanager = false but I need to use membership roles.   my connection strings are:  <connectionStrings> <add name="ConnMSSQLASP" connectionString="Data Source=MISFS;Initial Catalog=ASPNetDB;User Id=----;Password=-----;" providerName="System.Data.SqlClient"/> <add name="DisasterRecoveryConnectionString" connectionString="Data Source=MISFS;Initial Catalog=ASPNetDB;User Id=----;Password=----" providerName="System.Data.SqlClient"/> </connectionStrings>    Can someone help me with this? ERROR Below: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error: The connection string s
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend