Data browsing and navigation
Page 1: Set and Connect
More of this Feature
• Page 2: Browse and navigate
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
• Coloring DBGrid
• Database Form Wizard
• Selecting Fields.howto
Welcome to the fourth chapter of a free DB Delphi Course! So far, this course has provided enough
information to connect to an Access database and even to display a graphical data inside a database table. In the last chapter we were discussing some *advanced*
database programming techniques - let's go back to more *for beginners*
level now.
This time, you will see how to build a form (the real one) that can be used to browse through the records of a database table.
All the examples presented in the previous chapters have used several data-enabled (ADOTable, DBGrid, ...) components without to much explaining what each component is designed for, and how all those data components link together.
Working together...
When developing ADO-based Delphi database applications, the
http://delphi.about.com/library/weekly/aa032001a.htm (1 of 4) [24.11.2002 17:05:07]
in this topic
Game Programming Kylix (D on Linux)
Coding standards
All articles on this topic
components on the Data Controls page, the ADO page, and the Data Access page of the component palette allow our application to read from and write information to databases.
Every (ADO) data-aware Delphi form, in general, consist of
· several data-aware controls (Data Controls tab) that create a visual user interface (the look of the data form).
· one DataSource component (Data Access tab) that represents an interface between a dataset component and data-aware controls on a form.
· one or more dataset components (ADO tab) that provide access to the data residing in a database table or query.
· a connection component (ADO tab) that points all the dataset components to a specific data store.
Data Controls
Delphi's data-aware components are components that normally reside on a Standard palette tab but have been modified to display and manipulate the content of data in a dataset (table or query). The choice of controls is determined by how we want to present the information and how we want to let users browse (and manipulate - add or edit) through the records of datasets.
DBEdit and DBMemo, for example, are used to represent an individual record from a dataset. The DBGrid, on the other hand, is generally used when representing the contents of an entire dataset. Since all the data-aware controls are counterparts to the standard Windows controls - with a few extra properties, building a functional database application should be a relatively familiar task.
All the data-aware components share one common property:
Data Source.
Data Source
Simply put, the DataSource component provides a mechanism to hook dataset components to the visual data-aware components that display the data. You generally will need one datasource component for each dataset component to present a link to one or more data-aware controls.
Datasets
To create an ADO based application, Delphi provides us with four dataset components: TAdoDataSet, TAdoTable, TAdoQuery and TAdoStoredProc. All of the components are designed to retrieve, present and modify the data. All those components can connect directly (as like in the previous chapter's examples) to an ADO data store (such as data in an Access database) through it's ConnectionString property or they can chare a single connection.
When connecting through a TAdoConnection the Connection specifies an ADO connection object to use to connect to an ADO
http://delphi.about.com/library/weekly/aa032001a.htm (2 of 4) [24.11.2002 17:05:07]
Stay up-to-date!
Subscribe to our newsletter.
Advertising
> Free Credit Report
> Free Psychics
data store.
ADO Connection
The ADOConnection component is used to establish a connection with an ADO data store. Although each ADO dataset component can directly connect to a database, we will typically want to use the ADOConnection component since the component provides methods and properties for activating the connection, accessing the ADO data store directly and for working with transactions. In order to connect to a specific database, we use the
ConnectionString property.
Now, when we know the theory it's time to see some action. The next step is to build a data form. Before we move on, it'll be a good idea to open the database with Access and add some
"dummy" data (3-4 records) to a database just to have some operational data.
Next page > Browse and navigate > Page 2
All graphics (if any) in this feature created by Zarko Gajic.
More Delphi
· Learn another routine every day - RTL Quick Reference.
· Download free source code applications and components.
· Talk about Delphi Programming, real time. Start a chat now!
· Link to the Delphi Programming site from your Web pages.
· Tutorials, articles, tech. tips by date: 2001|2000|1999|1998 or by TOPIC.
· NEXT ARTICLE: Spell Checking with MS Word.
Why buy spell checking components or write them from scratch when you can easily use MS Word? Find out how to add spell checking and thesaurus capabilities to your Delphi application using the MS Word Object Library.
Stay informed with all new and interesting things about Delphi (for free).
Subscribe to the About Programming Newsletter
Name Email
Got some code to share? Got a question? Need some help?
http://delphi.about.com/library/weekly/aa032001a.htm (3 of 4) [24.11.2002 17:05:07]
Enter Email Go!
subscribe
Recent Discussions
Delphi Programming
Join these forum conversations Extracting digital audio from cd
Delphi disadvantages compared to VS.Net Keep An Application Always On Top Delphi7 adoblob problem
Searching in a text file or wide string
Email this page!
Explore More on the About Network!
Related Sites
C/C++
Focus on Java Focus on Linux Focus on Windows HTML/XML
Brand New Malibu
Auto Buying Guide Philip Powell takes a closer look at Chevrolet's sexy new 2004 Malibu.
Road Radio
Driving this Thanksgiving?
Radio Guide Corey Deitz explains how to find the right station.
Weird Science
Paranormal Guide
Steven Wagner looks at strange scientific experiments throughout history.
Search About
About Us | Advertise on This Site | User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright © 2002 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.
http://delphi.about.com/library/weekly/aa032001a.htm (4 of 4) [24.11.2002 17:05:07]
Explore more...
About > Computing & Technology > Delphi Programming
with Zarko Gajic Your Guide to one of hundreds of sites
Home · Articles · Forums · Chat · Classifieds · Newsletters · Help
Shop for Holiday Gifts from merchants like Old Navy, Eddie Bauer, Spiegel, and more!
ADO DB programming·
Delphi for .NET·
Free code APPs &VCL
·
A-Z Site Index BUYER'S GUIDEWhat's New and Hot Top Picks-Tool/VCL
Beginners Here COM/OLE/ActiveX Database
Distrubuted comp.
RTL reference|Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link To