此元素可以包含 segment 子元素。 如果它至少包含一个 segment 元素,则连接字符串会与其串联。 否则,连接字符串取自 ConnectionString 元素文本(在当前版本中时)。
此元素包含一个名为“Type”的必备属性,它有两个合法值;text 和 file。 当 Type= “file”时,Segment 元素必须至少包含一个 File 元素。 每个 File 元素被视为一个不同的查询。
此元素包含的属性定义应在连接字符串中使用的文件以及在适配器读取文件完成时必须对该文件执行的操作。
注意:仅在希望适配器更改 schema.ini 文件时,才使用此属性。
已添加另外两个内部变量,并可在 SelectStatement 和 SelectInitialValues 元素中使用这两个变量。 它们是:
示例 1:用于 Oracle 的简单连接字符串:
<ConnectionString> Provider=msdasql;dsn=O; uid=O; pwd=O </ConnectionString>
或者
<ConnectionString> <Segement Type="text" Text="Provider=msdasql;"/> <Segement Type="text" Text="dsn=O; "/> <Segement Type="text" Text="uid=O; "/> <Segement Type="text" Text="pwd=O; "/> </ConnectionString>
示例 2:用于单个 Excel 文件的简单连接字符串:
<ConnectionString>Driver={Microsoft Excel Driver (*.xls)}; DriverId=790;
Dbq=d:\Oblicore\Availabilty_2003_01.XLS
</ConnectionString>
或者
<ConnectionString>
<Segement Type="text" Text=" Driver={Microsoft Excel Driver (*.xls)};"/>
<Segement Type="text" Text=" DriverId=790;"/>
<Segement Type="text" Text=" Dbq="/>
<Segement Type="File">
<File Path="d:\Oblicore " NamePattern="Availabilty_2003_01.XLS">
</Segement>
</ConnectionString>
示例 3:用于若干个 Excel 文件的简单连接字符串:
<ConnectionString>
<Segement Type="text" Text=" Driver={Microsoft Excel Driver (*.xls)};"/>
<Segement Type="text" Text=" DriverId=790;"/>
<Segement Type="text" Text=" Dbq="/>
<Segement Type="File">
<File Path="d:\Oblicore ",NamePattern="Availabilty_*.XLS"/>
</Segement>
</ConnectionString>
示例 4:使用标准 ODBC DSN 条目:
使用标准 ODBC DSN 条目,您可以连接到在应用程序服务器上的 ODBC 管理器中创建了 DSN 条目的任何源。 可在服务器的“管理工具”部分找到标准 ODBC DSN 条目。
<ConnectionString>dsn=SampleDataSource;usr=scott;pwd=tiger;</ConnectionString>
| 版权所有 © 2012 CA。 保留所有权利。 | 就该主题发送电子邮件至 CA Technologies |