Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 549493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:11:25+00:00 2026-05-13T11:11:25+00:00

I’m trying to produce a column ‘start/length’ spec document from a SSIS package that

  • 0

I’m trying to produce a column ‘start/length’ spec document from a SSIS package that exports a DB table to a flat file. I have hit something of a brick wall in getting the Columns property from the ConnectionManager object that handles the flat file connection. I am able to get the Columns property, but I cannot do anything with it, as I cannot determine any type to cast it to. If I cast it to DTSProperty, I get very few useful properties on the object. If I get the property as object, all I can determine is that it is a System.__ComObject.

How do I retrieve the Columns property as a useful object, hopefully a collection, that I can iterate over?

Sample code:

        DTSRT.Application dtap = new Application();
        DTSRT.Package pkg = dtap.LoadFromDtsServer(@"\MSDB\ExportSamples", "ERISIA", null);
        DTSRT.ConnectionManager ffcn = pkg.Connections["DestinationConnectionFlatFile"];
        DtsProperty cols = ffcn.Properties["Columns"];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:11:25+00:00Added an answer on May 13, 2026 at 11:11 am

    UPDATE: Ok the answer below seems like it’s irrelevant in this context (though still useful in some sense, so I’ll leave it). I failed to consider that the Flat File ConnectionManager has the columns available to it rather than having to go via a source/destination component with output/input columns

    The value (GetValue) of the Columns property should be cast to IDTSConnectionManagerFlatFileColumns100 (or 90 if you’re using the SQL Server 2005 API)

    Alternatively, cast your configuration manager’s InnerObject to IDTSConnectionManagerFlatFile100 which exposes a Columns property.

    (These interfaces can be found in Microsoft.SqlServer.Dts.Runtime.Wrapper)


    Not sure how relevant this is to your context and if you still require this, but I just did something similar, so I thought I’d share:

    The code below will list all the columns of an Excel 2007 file, by building an SSIS package on the fly (You’ll need to reference Microsoft.SqlServer.DTSPipelineWrap, Microsoft.SqlServer.DTSRuntimeWrap, Microsoft.SQLServer.ManagedDTS and Microsoft.SqlServer.PipelineHost).

    As far as I can see, the only difference is that you’d have to interogate your loaded package to get the DataFlow task and relevant Flat File Destination component with its connection manager (in my case I created the relevant objects myself) and get its Input columns rather than Output columns.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SqlServer.Dts.Runtime;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    
    namespace SSISListColumns
    {
        class Program
        {
            static void Main(string[] args)
            {
                // Create package
                Package package = new Package();
    
                // Create excel connection manager and set connection string
                string fileName = "sampledata.xlsx";
                ConnectionManager connection = package.Connections.Add("EXCEL");
                connection.Properties["ConnectionString"].SetValue(connection, string.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES""", fileName));
    
                // Add Data Flow task
                Executable e = package.Executables.Add("STOCK:PipelineTask");
                TaskHost thMainPipe = e as TaskHost;
                MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; 
    
                // Add Excel Source component
                IDTSComponentMetaData100 component = dataFlowTask.ComponentMetaDataCollection.New();
                component.Name = "ExcelSource";
                component.ComponentClassID = "DTSAdapter.ExcelSource.2";
    
                // Set Excel Source properties (connection manager, access mode and sheet/rowset)
                CManagedComponentWrapper instance = component.Instantiate();
                instance.ProvideComponentProperties();
    
                if (component.RuntimeConnectionCollection.Count > 0)
                {
                    component.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(package.Connections[0]);
                    component.RuntimeConnectionCollection[0].ConnectionManagerID = package.Connections[0].ID;
                }
                instance.SetComponentProperty("AccessMode", 0);
                instance.SetComponentProperty("OpenRowset", "Sheet1$");
    
                // Activate
                instance.AcquireConnections(null);
                instance.ReinitializeMetaData();
                instance.ReleaseConnections();
    
                // List output columns
                var output = component.OutputCollection[0];
                foreach (IDTSOutputColumn100 column in output.OutputColumnCollection)
                {
                    Console.WriteLine(column.Name);
                }
    
                Console.ReadKey();
            }
        }
    }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 271k
  • Answers 271k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Depending on what you want to do (or achieve), you… May 13, 2026 at 1:45 pm
  • Editorial Team
    Editorial Team added an answer Read this: http://www.itnewb.com/v/Creating-the-Smooth-Scroll-Effect-with-JavaScript This article will help you a lot… May 13, 2026 at 1:45 pm
  • Editorial Team
    Editorial Team added an answer You should only create the connection once since the signal… May 13, 2026 at 1:45 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.