all groups > sql server dts > september 2006 >
You're in the

sql server dts

group:

How can I extract all relevant meta data from a ConnectionManager of type "FLATFILE"


How can I extract all relevant meta data from a ConnectionManager of type "FLATFILE" Amnon
9/19/2006 5:11:33 PM
sql server dts:
Hello,

I am writing a custom Data Source that accepts an instance of a flat file
connection manager.

Once I have a reference to this connection manager (ConnectionManager object
with CreationName="FLATFILE"),
does anybody know how can extract all its relevant meta data - especially
the list of column names?

I have succeded getting some properties of the columns (but not the column
names) through the following code.
Is there any other way to do it that will get me the whole thing?

IDTSConnectionManagerFlatFile90 ff90 =
(IDTSConnectionManagerFlatFile90)myFlateFileConnection.InnerObject;
DTSConnectionManagerFlatFileColumns90 cols = ff90.Columns;

int cnt = cols.Count;
IEnumerator enm = cols.GetEnumerator();
bool more = enm.MoveNext();
IDTSConnectionManagerFlatFileColumn90 nextCol;

while(more)
{
nextCol =
(IDTSConnectionManagerFlatFileColumn90)enm.Current;
// ...
// I GET HERE ALL THE PROPERTIES OF THE COLUMNS
// BUT NOT THE NAME OF THE COLUMN ???
//
more = enm.MoveNext();
}

Thank you
Amnon

RE: How can I extract all relevant meta data from a ConnectionManager of type "FLATFILE" Fil
11/5/2006 7:08:47 PM
Hello Amnon,

You cannot (at least i've tried hard enough) to convert a IDTSConnectionManagerFlatFileColumn90 into a FlatFileColumn object, but there is a way to get it's name. The example is posted by Microsoft but it is a little bit hidden... Here it goes, just completing your code:

nextCol = (IDTSConnectionManagerFlatFileColumn90)enm.Current;

IDTSName90 name = nextCol as wrap.IDTSName90; //this Interface represents the name of various objects from the DTS namespace

string colName = name.Name; //There it goes! here is the name of the column

I Hope it helps!
Fil

EggHeadCafe.com - .NET Developer Portal of Choice
AddThis Social Bookmark Button