Fill in the data (Filling Some Data)
In order to have some "dummy" data, fill in the following four records in the Type table: "Game", "Database", "Internet", "Graphics ( Graphics ". These values will be used when selecting the type of application stored in the Applications. Next, add a line in the author's table (Authors): 'delphi guide', 'delphi.guide@about.com', 'http://delphi.about.com'. Finally, add a line in the application table (Applications): 'Zoom', 'Zooming The Destop', 'Delphi Guide', 'Graphics', 10, 0, 02/20/2001, while letting the last field (photo )Is empty.
How to deal with these "blank" databases ... The rest of this tutorial will be described.
Chapter 2 connects to the database, use ADO? BDE?
First quarter Delphi database connectivity
As shown in the previous chapter, the database is a collection of one or more tables stored in a certain structural format. These tables contain data in the form of rows, columns. When a database contains one or more tables, these tables typically have dispersion but related data. MS Access, Interbase, SQL Server uses a file to represent a full database (MS Access is * .mdb file). On the other hand, Paradox and DBase are defined by separate tables and files representing indexes and table relationships. Describe all files in the Paradox database usually store them in a directory. Of course, Delphi can work in both ways.
With Delphi, we can connect to different types of databases: local or C / S (remote server) database. Local data inventory is placed in a local drive or in this region. Remote database servers are typically located at the remote machine. The types of local databases are PARADOX, DBASE, and MS Access. The C / S database has MS SQL Server, InterBase or Oracle.
Local databases are often referred to as single layer databases. Single-layer databases for any changes such as editing data, insert record, or delete record - immediately implement it. Single-layer databases are limited in the amount of data size accommodated and the amount of users supported by the application. When the database contains information about complex relationships between tables, or when the number of clients increases, you need to use two or multi-layer applications. The client application runs on the local machine; there should be multi-operated multi-run on the server, and the database may be in another server. The idea of multi-layer system is that client programs can be very small because the application server can do a lot of work. This allows you to write so-called thin client applications.
When we write database applications with Delphi, we need to access the database of the database with some database engines. Databases please allow you to focus on what data you visit, instead of how to access it. From the first edition, Delphi provides BDE (BORLAND DATABASE Engine) for database developers. In addition to BDE, from the fifth edition, Delphi provides support for Microsoft's ADO database interfaces.
This tutorial will focus on developing single layer database applications with MS Access local database. Section 2 Borland Database Engine (BDE)
BDE is all Borland products-including Delphi and C Builder-a common data access layer. BDE is a collection of DLL (Dynamic Link Libraries) and tools. Its beauty is that all data processing is transparent to developers. BDE has a set of drivers that allow your application to communicate with a variety of different types of databases. These drives translate high-level database commands (such as Open or POST) and tasks (record locks or SQL structures) to specific commands required for special database types, these special databases are: Paradox, DBase, MS Access, or any ODBC data source. The BDE API (Application Programming Interface Application Program) contains more than 200 processes and functions, which can be obtained from the BDE unit. Fortunately, you almost do not need to call these programs directly. Conversely, use the data access component of the Component Panel (Data Access) using the Data Access page (Data Access) of the Component Panel by VCL (Translator). In order to access a special database, the application only needs to know the database's alias (Alias) to access all the data of the database. An alias is established in the BDE Administrator, which specifies the location of the drive and the location of the database. BDE comes with a database drive set, you can access a wide range of different types of data elements. Standard BDE drivers include Paradox, DBASE, MS Access, ASCII text. Of course, any ODBC driver can also be used by BDE via the ODBC Administrator.
Delphi application using BDE access to the database needs to distribute BDE for your application. When configuring the BDE of the application, you must use installshield express or other Borland to specify the installer.
BDE has its advantages as a database engine. However, in this tutorial will not discuss why and when you should (or should not) use BDE methods instead of certain non-BDE technology.
Since this tutorial is to discuss ADO / MSACcess, the remainder will focus on this non-BDE database method.
December 22, 2002