Look at the case study VFP: Create a new table from fields in multiple tables

Source: Internet
Author: User
Tags join

In this example, review the knowledge of the INNER JOIN clause in the SELECT statement, and for the SELECT statement, refer to the Select SQL command or the SQL language tutorial. The main operation of this example is done in the Init event of the form. Make a connection query in the event and output the query results as a temporary table (the table includes the name, gender, base salary, 3 fields of the Personnel information table, and the "bonus, living allowance, Endowment Insurance" 3 fields) of the "payroll". Finally, the table is set as the data source for the table control. This example applies to the data environment, and uses the "People Information table" and "payroll" in the Data 1 database as the data source of the data environment, and the situation of the database is already looking at the case study VFP: sample database is given in the article, the running interface is shown at the end of this article.

A new form, set its Caption property value to "Get started with programming-create a new table using fields from multiple tables", set the AutoCenter property value to. T.,width property value is set to 375,height property value set to 250, and the form is saved as " Create a new table using fields from multiple tables. Scx ".

Add a Label control to the form and set its Caption property value to "details."

Third, add a table control below the label control and set its RecordSourceType property value to 1-alias, and the ReadOnly property value to. T.

Four, right click the blank space of the form select the Data Environment command to add the people information table and the payroll table to the data environment.

To adjust the position of each control on the form, the Adjusted form Designer is shown in the following illustration:

Vi. Add event code:

Init event code for the form:

Select Person Information table
select name, sex, base salary, bonus, life supplement, endowment insurance from personnel information table;
 Inner Join Payroll on Staff Information table. Number = Payroll. Employee number into cursor LSB
thisform.grid1.columncount=-1
Thisform.grid1.recordsource = "LSB"

Run "Create a new table using fields from multiple tables." SCX ", the interface is shown in the following figure:

Resources:

The basic course of VFP: http://bianceng.cnhttp://www.bianceng.cn/vfpjc/index0.htm

VFP Primary Course: http://bianceng.cnhttp://www.bianceng.cn/cc/index.htm

VFP Intermediate Course: http://bianceng.cnhttp://www.bianceng.cn/mcc/mcc.htm

VFP Advanced Course: http://bianceng.cnhttp://www.bianceng.cn/hcc/hcc.htm

VFP Network Development: http://bianceng.cnhttp://www.bianceng.cn/VFPwz/vfpwlkf.htm

VFP Call API function: http://bianceng.cnhttp://www.bianceng.cn/VFPwz/vfpapi.htm

VFP Report Print: http://bianceng.cnhttp://www.bianceng.cn/VFPwz/vfpreport.htm

VFP Common technique: http://bianceng.cnhttp://www.bianceng.cn/VFPwz/vfpcyjs.htm

VFP Experience Summary: http://bianceng.cnhttp://www.bianceng.cn/VFPwz/vfpjyhz.htm

VFP Control use: http://bianceng.cnhttp://www.bianceng.cn/VFPwz/vfpkjsy.htm

VFP Data processing: http://bianceng.cnhttp://www.bianceng.cn/VFPwz/vfpsjcl.htm

This example code is debugged in the win2003+vfp6.0 environment.

See the full set of "rookie also learn VFP" tutorial

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.