How to efficiently use various data aware component in Delphi. Look for information on TTable, TQuery, TDBGrid, TDBNavigator ...
You've seen this surely on web pages. Alternating table row colors means displaying the first record in one color and the second record in another color and continue to alternate the color of each row displayed. Here's the OnDrawColumnCell event handler for a Delphi DBGrid control to color every second row in a different color.
What most Delphi developers are not aware of, is that you can even implement the OnMouseHover behavior to change the display (color, font, etc.) of the DBGRid's (data) row underneath the mouse - thus making it look like todays web driven interfaces.
When creating database applications in Win32 Delphi you might find the multicast idea useful - to have more than one procedure execute when the OnAfterScroll event fires for the TDataset descendant, for example. The "TMultiDsEvent" class enables you to add multicast event handlers feature TDataSet and TField descendants.
Contrary to most other Delphi data-aware controls, the DBGrid component has many nice features and is more powerful than you would have thought. The "standard" DBGrid does its job of displaying and manipulating records from a dataset in a tabular grid. However, there are many ways (and reasons) why you should consider customizing the output of a DBGrid...
While DBGrid has many properties and events you can use to create nicelly looking and highly configurable user interfaces for data editing, there are always situations when users want more. Let's see how to add the "AutoFit" functionality to the Columns of a TDBGrid component...
If you allow a user to customize DBGrid's appearance at run time (Columns width and position), when the form is closed and reopened, all the user changes are lost. For a better user experience it would be ideal if your application could somehow store (and load when needed) all the changes the user has made to the Grid appearance. Here's how.
Looking for a single-file, single-user database for your next Delphi application? Need to store some application specific data but you do not want to user the Registry / INI / or something else?
In more than 25 chapters learn how to use various ADO components in Delphi.
How to place just about any Delphi control (visual component) into a cell of a DGBrid. Find out how to put a CheckBox, a ComboBox (drop down list box) and even an Image inside the DBGrid.
Here's a handy method to automatically fix the size of TDBGrid columns (at run-time) to fit the DBGrid width (remove the unfilled space at the right edge of the grid; and consequently remove the horizontal scroll bar) when the user resizes the container containing the grid.
How to enhance the functionality of a TDBgrid component using colors.
Enhancing the TDBNavigator component with modified graphics (glyphs), custom button captions, and more. Exposing the OnMouseUp/Down event for every button.
Multiple row selection in Delphi DBGrid - providing the ability to select multiple records within the grid. A Beginner's Guide to Delphi Database Programming: Appendix A.
How to retrieve, display and edit Microsoft Excel spreadsheets with ADO (dbGO) and Delphi. This step-by-step article describes how to connect to Excel, retrieve sheet data, and enable editing of data (using the DBGrid). You'll also find a list of most common errors (and how to deal with them) that might pop up in the process.
How to display a dataset of records from a table/query in a treeview component.
How to sort records (ADO dataset) in Delphi DbGrid by clicking on the column title. Plus: how to change the appearance of the selected column title to reflect the sort order. Even more: how to change the cursor when moving over the DBGrid column titles.
Here's a simple trick to set the input focus to a specific cell of a TDBGrid component. Given the DBGrid's active row and field name (or the column index) the cell receives the input focus and becomes active.
How do you access non-relational data (such as a disk directory) with data-aware controls? Rely on a key element of Delphi: the TDataSet class
A technique for implementing auto-incrementing fields for any DataSnap server.
This example dynamically creates TFieldDefs, TFields, calculated fields, a table, a TTable, and attaches an event handler to the OnCalc event.
A general overview of the heart of the BDE. The placement and configuration of Table, Query, StoredProc, and Database components is also discussed. Use of non-VCL database development available in Delphi 5 is also addressed.
This presentation covers some of the internal workings of TDataset. The core functions needed to implement your own custom dataset are discussed and a demonstration dataset is developed.
This project demonstrates listing the field structure from a given table, using the Fields and IndexDefs arrays, and displaying them in a listbox.
The TDecisionCube component that ships with Delphi Client-Server or Enterprise does not work well with non-BDE datasets. But we can change that.