You are here:About>Computing & Technology>Delphi Programming
About.comDelphi Programming
Connecting to a database. BDE? ADO?
Page 3: The ADO programming model.
 More of this Feature
• Page 1: Delphi database connectivity
• Page 2: the BDE
• Page 4: Connecting to a database
 
 Join the Discussion
"Post your views and comments to this chapter of the free Delphi database Programming Course"
Discuss!
  Related Resources
• free DB Course.TOC
• Delphi DB articles
 Elsewhere on the Web
• MS Data Access Page
• Data access dilemma - BDE/ADO
 

As stated in the Introducing ADO in Delphi article, ADO is a set of COM components (DLLs) that allow you to access databases as well as e-mail and file systems. Applications built with ADO components don't require the BDE.
To access any kind of database with ADO, you'll of course need to have ADO/OLE DB libraries. Everything you need to use ADO is probably already on your computer: the files are distributed by Microsoft as a part of Windows 98/2000. If you or your client use Windows 95 or Windows NT you will probably need to distribute and install the ADO engine. Delphi 5's CD includes an installation of MDAC - Microsoft Data Access Components. You should always make sure to have the latest version, which is available from Microsoft. The Microsoft Data Access Components are the key technologies that enable Universal Data Access. They include ActiveX Data Objects (ADO), OLE DB, and Open Database Connectivity (ODBC).
Note: to install correctly on a Windows 95 computer, MDAC requires that DCOM95 be installed. MDAC installs components that rely on DLLs installed by DCOM95 in order to register correctly. Note that DCOM95 is not required on a Windows NT 4.0. In some cases, DCOM may not be installed on a Windows 98 computer. If it has not been installed, then DCOM98 should be installed prior to the installation of MDAC.

Without to much talking about OLE DB and ADO let's move on to more practical topics.

ADO Objects
The ADO programming model is built around several ADO objects that provide you with the productive means for accessing all kinds of data sources. These objects provide the functionality to connect to data sources, query and update record sets, and report errors. Delphi, through several VCL components provides wrapper components to access those objects. Let's see what are some of the Objects ADO works with:

The Connection object represents a connection to the data source with the connection strings. In BDE/Delphi a Connection object is a combination of the Database and Session components.

The Command object enables us to operate on a data source. Ir represents a command (also known as a query or statement) that can be processed to add, delete, query or update the data in a database.

The Recordset object is a result of a Query command. You can think of a Recordset as a Delphi Table or Query component. Each row that the Recordset returns consists of multiple Field objects.

Several other objects like: the Field object, the Parameter Object and the Error object also exist in ADO model - will get back to them in the following chapters of this course.

Next page > Connecting to a database > Page 1, 2, 3, 4

From Zarko Gajic,
Your Guide to Delphi Programming.
FREE Newsletter. Sign Up Now!
Newsletters & RSSEmail to a friendSubmit to Digg
 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.