BDC (business data catalog) Practice

Source: Internet
Author: User
Tags import database

1. Import database connection operations(Note: My data server address is local and the database is sqlserver)
1. Click Start> All Programs> Microsoft business data catalog definition editor
2. Click addlobsystem-> connect to database.
3. Select sqlserver in connect type
4. In connect string, enter the following string for connection.
Data Source =.; initial catalog = boco; Integrated Security = true, as shown in.

5. Click Connect to connect the database.
My database table structure is as follows:

2. Add the table to the lob system.
Click Add Table in the top-right corner of the lob system, drag the employee to the design surface on the left, click OK, enter bdcemployee In the lob system name, and click OK.


Now let's take a look at the connected bdcemployee. The visible tool automatically generates two methods for me. find_employee queries data using the keyword ID in the table. Another method, findall_employee, is to query all the data in the table.

3. Add a new method.
Right-click method-> click Add method to generate a method named Method1. The current name is not very good. We changed it to finddatabyname. The method is: Click Method1, change the value of name to finddatabyname on the right side, and then click the value of defadisplaydisplayname. The value also changes to finddatabyname.
Right-click filters under finddatabyname and click Add filter

Click filterdescriptor1, change the name to name on the right, and click defaultdisplayname, which is automatically displayed as name.
Now we add two parameters, one being the input parameter and the other being the returned parameter.
1. Add input parameters
Right-click parameters, click Add parameter, and select in

Click OK.
Change parameter0 to @ name.
Click parameter0, change the name value on the Right To @ name, and click @ displaydisplayname to change it to @ name.
Right-click @ name and click Create root typedescriptor. In the filterdescriptor attribute value, click the drop-down menu and select the filter value: Name. change the value of the name attribute to name, and click defaultdisplayname to change the value to name. Click name to view the value type of typename on the right as system. string. The input parameter is added.

2. Add return parameters
Right-click parameters and click Add parameter. After selecting return for choose parameter type, click OK.
Change parameter1 to result.
Click parameter1, change the name value on the right to result, and click defadisplaydisplayname to change it to result.
3. Right-click the result and click Create root typedescriptor.

Change result_roottypedescriptor to datareader.
Right-click datareader and click Add typedescriptor.


Change typedescriptor0 to dataRecord as shown in the preceding method.
Add the input parameter ID and name of the two data examples in the table.
Right-click dataRecord and click Add typedescriptor to change typedescriptor0 to ID.
Right-click dataRecord and click Add typedescriptor to change typedescriptor1 to name.
So far, the parameter has been added. Maybe you have to ask why the output parameter needs to be added to such depth, so my understanding is only to the number of energyTypenameIsSystem. StringThe result is displayed when the method is executed. Typename in the following two figures.
 

4. Add an instance for method execution
Method: Right-click instances and select Add Method Instance.


Select finder in Method Instance type below

Click OK.
Change the instance method name to querydatabyname.
Finally, we need to write the query statement with input parameters to rdbcommandtext in the finddatabyname method. The Code is as follows:

Select "ID", "name" from employee where name = @ name


5. Execution
Right-click querydatabyname and click Execute

In the displayed execute querydatabyname dialog box, enter fans in the Value Field and click Execute


The execution result is as follows:

As the previous database knows, this demo can correctly query the desired results.

Last BDC Installation
Next BDC is deployed on the SharePoint site

Related Article

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.