ADO (ActiveX Data Objects) |
Contents A. ADOExpress Step-by-Step-from-Scratch Tech Notes |
Also see Zarko Gajic's Delphi Database Programing Course
A. ADOExpress Step-by-Step-from-Scratch Tech Notes
These Tech Notes assume Delphi 5 and ADOExpress are installed in
a Windows 98 environment.
The motivation for these notes was the lack of documentation provided by Borland on this
topic.
| 1.
UDL files -- Microsoft Data Link Files An ADO database connection is established using a Microsoft Data Link. A Data Link is stored in a UDL file, which usually is created manually in Windows 98. When a UDL files is not directly used, the same information is stored in the properties of a TADOConnection component in a DFM (form) file. These instructions show how to manually or programmatically create UDL files. |
| 2. DBF Files -- With and Without ADO These instructions show how to connect to a DBF (dBase) file with or without the ADO. The ADOTable component is used to access the data via ADO. Images can only be accessed when ADO is not used. |
| 3. Delphi 5,
ADOExpress, Access and
Images Many PCs with Microsoft Office have a sample Access database called "Northwind," which is useful for database experiments. This project shows that while the "normal" data can be manipulated in Northwind using Delphi and ADOExpress, there is no easy way (without yet-another-third-party-add-on) to display the images in this Access database using only Delphi 5 and ADOExpress. However, a crude "hack" is shown that does extract a TBitmap from the Photo TBlobField. More must be understood about this "hack" before the technique can be considered reliable and used in a "real" application. An ADOQuery component and an SQL query are used to access the data via ADO. |
| 4. SQL Query Using ADODataSet These instructions show how to use an ADODataSet component and an SQL Query to connect with a dBase database. This Tech Note fills in many details for "A Practical ADO Primer" example in Mastering Delphi 5, pp. 562-565. |
| 5. ADO Master/Detail and File Locking These instructions show how to use ADO to connect to an Access database over a local area network. A Master/Detail relationship is demonstrated. Multiple applications accessing the same database are explored. Database locking (optimistic versus pessimistic) is demonstrated. Part of this example is based on Mastering Delphi 5, Figure 12.8, p. 574. |
| 6. Running ADO Applications in Windows 95 ADO is built into Windows 98, and will be built into future versions of Windows, including Windows 2000, but there is no support for ADO in Windows 95. DCOM for Win 95 and MDAC 2.1, or later, must be installed in Windows 95 before running Delphi ADO applications. |
| 7. Briefcase:
UDL and ADTG The Briefcase demo program, distributed as part of ADO Express, looks fairly simple, but there are some not-so-obvious steps that are needed to reproduce the program. The Briefcase program establishes an ADO connection using a Data Link File (a UDL file). When the database connection is dropped, data can be accessed locally in an Advanced Data Table Gram (ADTG) file and later written to the database. |
| Books |
|
|||||||||||||||||||||
| Borland | Borland Delphi 5 Developer's Guide Chapter 23, Working with ADO Components, pp. 23-1 - 23-28 |
|||||||||||||||||||||
| Articles (D5) | Pictures inside a database -- Working with BLOBs. Storing
pictures in Access. http://delphi.about.com/compute/delphi/library/weekly/aa030601a.htm A Practical Guide to ADO Extensions: Part I, Using
ADOX and JRO A Practical Guide to ADO Extensions: Part II, ADO
Multidimensional "All Aboard the ADOExpress" by Ray Konopka Simplifying ADO Application Deployment "Delphi Does ADO -- A New Way to Get to Data" by Bill Todd in Delphi
Informant "Creating a Microsoft Excel Spreadsheet Viewer Using Delphi 5's ADOExpress"
by Scott Strool |
|||||||||||||||||||||
| Articles (pre-D5) | Accessing Databases Using ADO and Delphi (D4) http://community.borland.com/soapbox/techvoyage/article/1,1795,10270,00.html Much ADO about the Web: Using ActiveX Data Objects from Delphi Applications, Delphi Informant, Dec 1998 |
|||||||||||||||||||||
| Microsoft | HOWTO: Get XML Representation Of an ADO Recordset in Visual Basic http://support.microsoft.com/support/kb/articles/q252/7/67.asp Microsoft Documentation: UDA / OLE DB / ADO / ODBC ActiveX Data Objects Start Page ActiveX Data Objects ADO Programming Model Installing MDAC Q&A Release Manifest for MDAC 2.1 Microsoft Data Access Components (MDAC) SDK How To Use the ADO Shape Command ADO FAQ www.microsoft.com/data/eulamdac21.htm Defining and Retrieving a Databases Schema Migrating from DAO to ADO: Using ADO with the Microsoft Jet
Provider |
|||||||||||||||||||||
| Non-Delphi Resources | A Practical Introduction to ActiveX Data Objects (ADO) [Visual
Basic] www.vbonline.com/vb-mag/9806/article/ado.htm Introduction to ActiveX Data Objects ADO FAQs ADO Technology ADO Resources |
|||||||||||||||||||||
| Vendors/Products |
|
| Access | ADOX: Creating new Access Database www.geocities.com/SiliconValley/Lakes/1636/ADOX1.htm See ADOX_TLB before trying to compile this example. Access JRO (Jet and Replication Objects). See Roger Morton's UseNet Post response to the question "How Do I Compact / Repair Access Databases via ADO":
|
||||||||||||||||
| Acronyms |
|
||||||||||||||||
| ADO redistributable | ADO is built into Windows 98 and will be built into future versions of
Windows, including Windows 2000. To find out if ADO is installed, look for |
||||||||||||||||
| ADOX_TLB | Before you can have a "USES ADOX_TLB" clause, do
the following:
|
||||||||||||||||
| CreateUDLFile | Procedure in ADODB.PAS for creating UDL file programmatically. See Tech Note. | ||||||||||||||||
| Data Cache | Shannon Broskie's E-mail with suggestion about using ADO to 'cache' data only while the program is running, which then allows one to use ADO's capabilties of filtering and sorting along with the added bonus of ADO's ability to save data directly out to XML. | ||||||||||||||||
| DataLinkDir | Function in ADODB.PAS that returns the string stored in the
registry of the default location for data link files, usually, C:\Program Files\Common Files\System\OLE DB\Data Links Mark Edington's (Borland) UseNet Post about DataLinkDir function |
||||||||||||||||
| GetDataLinkFiles | Function in ADODB.PAS. <need better definition here> | ||||||||||||||||
| Patches | ADO Express Informal Update (by Mark Edington, Borland) http://ww6.borland.com/codecentral/ccweb.exe/listing?id=14080 |
||||||||||||||||
| GetProviderNames | Procedure in ADODB.PAS. <need better definition here> | ||||||||||||||||
| PromptDataLinkFile | Function in ADODB.PAS. <need better definition here> | ||||||||||||||||
| PromptDataSource | Function in ADODB.PAS. <need better definition here> | ||||||||||||||||
| TADOCommand examples |
|
||||||||||||||||
| Version | The ADOConnection.Version string returns '2.1' in Delphi 5. |
Links Verified 24 Jan 2000
Updated 20 Apr 2002
since 24 Jan 2000