[BTS] Functoid for BizTalk Learning (Database Lookup)

Source: Internet
Author: User
Tags biztalk
Development programs cannot avoid frequent access to the database. Here, the most common option is select * from SomeTable where ID =.
BizTalk must also provide a configurable Development Method for us !! It is the Database Lookup Functoid.

In this example, enter the user name, query the database, and obtain other data of the user.

Fegend-1 input data


Fegend-2 database table


Fegend-3 output data

The definition process of input and output Schema is omitted here, and the definition of Map is directly involved.
Add Database Lookup Functoid, Value Extractor Functoid, and Error Review Functoid to Map.

Map created by Fegend-4

Database Lookup Functoid has four input parameters
1. Value
2. Connection String
3. TableName
4. ColumnName
It completes the following code.
Connection conn = new Connection (ConnectionString);
Command cmd = new Command ("select top 1 * fromTableNameWhereColumnName=Value", Conn)

Configurations in Fegend-5 Database Lookup

After the Database Lookup Functoid is queried, An ADO Record is obtained.
Here, the Value Extractor Functoid must be used to read the Record data.
Of course, the following code
String value = Reader ["Name"]. ToString ();

Configuration of Fegend-6 Value Extractor

The Error Review is used to capture errors generated during Database Lookup Functoid running.

Fegend-7 capture exceptions

You will find that it is not very troublesome to set ConnectionString in Database Lookup Functoid. Of course there are methods. You can use UDL files!
Create a UDL file and double-click it for configuration.

Fegend-8 UDL File


Fegend-9 configuration data source

In this way, you can directly use
File Name = c: \ ...... \ *. UDL
File to set ConnectionString. However, its use may cause some performance problems, because every time you connect to the database, you have to read files.

Fegend-10 modify ConnectionString

It was not until today that a Database Lookup routine was completed, which is very convenient to use!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.