如何在SSIS中使用EzAPI FlatFile Source?

发布于 2024-09-17 19:04:59 字数 670 浏览 7 评论 0原文

我正在使用 EzAPI 使用 FlatFile Source 创建数据流,

public class EzOleDbToFilePackage : EzSrcDestPackage<EzFlatFileSource, EzFlatFileCM, EzOleDbDestination, EzSqlOleDbCM>

使用 http://blogs.msdn.com/b/mattm/archive/2008/12/30/ezapi-alternative-package-creation-api.aspx 我我正在尝试使用平面文件源。但是,在平面文件源/连接中,我无法映射平面文件中的列。

zFlatFileSource 有类似 Dest.DefineColumnsInCM() 的东西吗?

在 BIDM 中,当我打开创建的包时,我看到 EzFlatFileCM 表示未为此连接管理器定义列。一旦我单击“列”,它就会自动检测所有内容,并且错误就会消失。我需要在代码中调用什么方法才能让 EzFlatFileSource 自动选取这些列?

I am using the EzAPI to create a dataflow with FlatFile Source

public class EzOleDbToFilePackage : EzSrcDestPackage<EzFlatFileSource, EzFlatFileCM, EzOleDbDestination, EzSqlOleDbCM>

Using the example from http://blogs.msdn.com/b/mattm/archive/2008/12/30/ezapi-alternative-package-creation-api.aspx I am trying to use a flat file source. However in the flat file source/connection I am unable to map the columns from the flat file.

Is there something like Dest.DefineColumnsInCM() for the zFlatFileSource?

In the BIDM when I open the created package, I see that the EzFlatFileCM is saying Columns are not defined for this connection manager. As soon as I click on Columns it automatically detects everything and the error goes away. What method do I need to call in my code to get the EzFlatFileSource to automatically pick these columns up?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ゃ懵逼小萝莉 2024-09-24 19:04:59

来自 的人们http://blogs.msdn.com/b/mattm/archive/2008/12/30/ezapi-alternative-package-creation-api.aspx

我相信自动确定源列的逻辑内置于平面文件连接管理器 UI,并且无法通过代码访问(我肯定想更改这一点)。从我拥有的代码示例来看,您似乎需要手动定义列。

前任。

       pkg.SrcConn.Unicode = (fileFormat == FileFormat.UNICODE);

       pkg.SrcConn.ConnectionString = srcFile;

       pkg.SrcConn.Columns.Add().DataType = dataType;

       pkg.SrcConn.Columns[0].ColumnType = "Delimited";

       pkg.SrcConn.ColumnNamesInFirstDataRow = false;

       pkg.SrcConn.ColumnDelimiter = ",";

       pkg.SrcConn.RowDelimiter = "\r\n";

       pkg.SrcConn.TextQualifier = "\"";

       pkg.SrcConn.Columns[0].TextQualified = testObject.textQualified;

       if (!pkg.Source.OutputColumnExists("col0"))

       {

           pkg.Source.InsertOutputColumn("col0");

       }

       pkg.Source.SetOutputColumnDataTypeProperties("col0", dataType, testObject.length, testObject.precision, testObject.scale, testObject.codePage);

From the folks at http://blogs.msdn.com/b/mattm/archive/2008/12/30/ezapi-alternative-package-creation-api.aspx

I believe the logic which automatically determines the source columns is built into the flat file connection manager UI, and isn't accessible via code (something I'd definitely like to change). From the code samples I have, it looks like you need to define your columns manually.

ex.

       pkg.SrcConn.Unicode = (fileFormat == FileFormat.UNICODE);

       pkg.SrcConn.ConnectionString = srcFile;

       pkg.SrcConn.Columns.Add().DataType = dataType;

       pkg.SrcConn.Columns[0].ColumnType = "Delimited";

       pkg.SrcConn.ColumnNamesInFirstDataRow = false;

       pkg.SrcConn.ColumnDelimiter = ",";

       pkg.SrcConn.RowDelimiter = "\r\n";

       pkg.SrcConn.TextQualifier = "\"";

       pkg.SrcConn.Columns[0].TextQualified = testObject.textQualified;

       if (!pkg.Source.OutputColumnExists("col0"))

       {

           pkg.Source.InsertOutputColumn("col0");

       }

       pkg.Source.SetOutputColumnDataTypeProperties("col0", dataType, testObject.length, testObject.precision, testObject.scale, testObject.codePage);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文