teach you to use C + + Builder to realize VFP database development

Source: Internet
Author: User
Tags connect odbc

C++builder has the outstanding database network development function, may access each kind of relational database, provides the efficient data aware component and the data access component, it not only can provide the client program for the C/s structure, but also may develop the application server program, realizes the Multi-layer database application architecture, VFP database is the best choice for network development.

VFP database system has two ways to establish a data table, one is to establish a free table compatible with the FoxPro, the other is to establish a database, the database contains data tables and relationships, so in C + + Builder use VFP database also exist in two ways, namely a way is directly called VFP free table, Another way is to use ODBC to invoke VFP database, this article will be illustrated separately.

Direct Call VFP Free table

1. Set up data table:

The data table structure is as follows:

字段名  类型   宽度
档案名称 字符型  100
存放名  字符型  2

2. Create form Form1:

Place controls such as Ttable, Tdatasource, TDBGrid, Tdbnavigator, and so on.

To set the Ttable control properties:

Tabletype is set as Ttfoxpro;

TableName is set as WJK.DBF;

The active setting is true.

Connect controls such as Tdatasource, TDBGrid, Tdbnavigator, and so on.

modifying, deleting, adding, and storing content can be implemented by Tdbnavigator controls or written programmatically.

Calling VFP database through ODBC

1. Access to the panel of ODBC data source to connect VFP database.

2. In the C++builder:

Place controls such as Tdatabase, Ttable, Tdatasource, TDBGrid, Tdbnavigator, and so on.

To set the Tdatabase control properties:

AliasName set to ODBC in the connection of the VFP database name;

DatabaseName is set to the user-defined database name in C + + Builder;

Params content is set to null;

Loginprompt to false;

Connected is true to connect to the database.

Other component setup methods are similar to free tables.

In the example above, direct call VFP free table speed, method simple, easy to operate, but when there is a composite index in the table will be called failure, you need to delete the composite index from the original table, before you can call from C + + Builder, and through ODBC call VFP database speed is not directly call fast, setting is more complex than free table, but preserves the original definition of the database.

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.