EzFlatFileCM.Columns.Add doesn't cast to IDTSName

Dec 27, 2014 at 12:46 PM
I'm trying to add columns to to my EzFlatFileCM but the object returned from the Add method doesn't implement IDTSName. Here's my code snippet:
            string header = string.Empty;
            using (var rdr = File.OpenText(srcConn.ConnectionString))
                header = rdr.ReadLine();

            string[] columns = header.Split(',');
            foreach (string c in columns)
                var col = srcConn.Columns.Add();
                col.ColumnType = FlatFileColumnType.Delimited.ToString();
                col.ColumnDelimiter = ",";
                col.DataType = Microsoft.SqlServer.Dts.Runtime.Wrapper.DataType.DT_WSTR;
                col.MaximumWidth = 1024;
                col.TextQualified = true;

                var columnName = col as IDTSName;
                if (columnName != null)
                    columnName.Name = c;
Any suggestions?
Dec 27, 2014 at 1:05 PM
Looks like I should have cast to IDTSName100 instead of IDTSName. I hadn't seen that as an option for intellisense because I hadn't added a using statement for Microsoft.SqlServer.Dts.Runtime.Wrapper.