Delphi is a visual software development tool developed by the famous Borland. There is such a sentence, the most classic, I have described Delphi - "The real programmer uses C, smart programmers with Delphi." Many people call Delphi as the fourth-generation programming language, which has simple, high efficiency, powerful features. Compared with Visual C , Delphi is simpler and easier to learn, but in function is not bad; Delphi is more powerful and more practical than Visual Basic. It can be said that Delphi has the characteristics of VC and VB, so it has always been a programming tool for the majority of programmers. Below, we will introduce you to Delphi's characteristics, common components, and methods and steps to develop database programs using Delphi. Since developing, from Delphi 1. Delphi 2 to the current Delphi 7, Delphi 8 (Borland Delphi .NET), Delphi continues to expand and improve its own function, characteristics, and advantages. Delphi provides a variety of development tools, including integrated environments, image editors, and applications for various development databases, such as Database Desktop, and more. Moreover, users are also allowed to mount other application development tools, such as Borland's resource editor (Resour Workshop). Among the many advantages of Delphi, it is particularly prominent in the database: suitable for multiple database structures, from client / server mode to multi-layer data structure mode; high-efficiency database management system and new generation more advanced Database engine; the latest data analysis means and provides a large number of enterprise components. First, let's briefly understand how Delphi has access to the database. Delphi's operation of the database is mainly based primarily using BDE (database engine, Borland Database Engine). Of course, through other ways directly access the database, it can be implemented in Delphi. However, for the local database, the BDE access data is high. If you can skilled your local database, you can easily get started. Especially for beginners, the opportunity to write network databases is not as much as a single-machine local database. So, we focus on the local database. BDE is an intermediate medium responsible for users and database exchanges. In fact, the application is connected by data access components and BDE, and then accesss the database by BDE to complete the operation of the database, not directly operating BDE. This way users only need to care about the data components in Delphi, do not have to deal with BDE directly. Database components are primarily divided into two categories: "Data Access Components" and "Data Control Components", their relationships with the database can be schematically: through BDE, almost all types of databases can be operated. Next, briefly introduce the database components used in Delphi. 1. Data Access Component Data Access Components can be found on the Data Access component page of the Delphi component panel. Here we should pay attention to: Table, Query and StoredProc three controls, which are called "Dataset components" for connectivity to databases. Learners can treat these controls as "virtual" databases, which can be considered to be the operation of the database. (1) DataSource control is a connection medium for data set components and data control components.
The data control component is the interface of the data in the user's operational database, and only the DataSource control can be connected to the data set component, thereby displaying, modifying, maintenance, etc. (2) Table control is to access the data in the database through the database engine - BDE. Pass the user to the database to the database via BDE. (3) The QUERY control is to operate the database with SQL (Structured Query Language, Structured Query), and the functions completed by the Table control are similar, which only uses SQL to implement. (4) The StoredProc control is a database application that is often used by the server / server (C / S) structure via BDE. (5) Database controls are generally used to establish a remote database server-client / server structure database application and database connections. (6) The session control is used to control database applications and database connections, mainly for complex functions, such as multithreaded database programming. 2. Data Control Component data control components can also be referred to as data display components or data browsing components. Their main function is to cooperate with the data access component to provide the user to browse, edit the operations of the data. Data Control Components on the DataControl page on the component board. They mainly include: DBGrid control, DBNavigator control, DBText control, DBEdit control, DBMemo control, DBImage control, DBListbox control, DBComboBox control, DBCheckBox control, DBRadioGroup control, DBLookupListBox control, DBLookupComboBox control, DBRichEdit control, DBCtrlGrid control, DBChart controls. In addition, some components are related to the database. For example, Decision Cube is a set of controls that are mainly used for data statistics, express statistics in an intuitive manner such as table or graphics. QReport is the control used to output reports, but according to experience, this control is not suitable for the habit of Chinese reports. This component is Borland to buy, and performance is not too good, so it is not much used now. At present, there are some report controls provided by third-party controls, and there are also some national states of report controls, which is very suitable for Chinese habits. Another component page is ADO (ActiveX Data Objects), mainly to access and operate data in the database server using Microsoft OLE DB function. Its main advantage is that it is easy to use, high speed, low memory payment, and storage space take up less. ADO supports the establishment of client / server-based applications. The ADO has a remote data service (RDS) function, and the data can be moved from the server to the client application or web page through RDS, and the client is processed to the client and then returns the update result to the server. ADO is now popular, and ADO itself is also very complicated. Microsoft has specialized helper files to explain how to use ADO. If learners are interested, they can find relevant information to learn further.