Delphi Tips and Tricks: Master-detail relationships ADO and Delphi
records Integrated development environment including database query and . Database design and development tool using an entity relationship diagram. An ADO. NET provider for accessing data of the omarcafini.info cloud CRM The InfoPower Delphi VCL includes a masterpiece grid supporting master-detail. Active Property · AutoRegister Property · Connection Property In Delphi for Win32 under Windows Vista all UniDAC demo projects are located compares performance of UniDAC with another components (BDE, ADO, dbExpress)] MasterDetail, Uses UniDAC functionality to work with master/detail relationships. Active Property · AutoRegister Property · Connection Property compatible with standard data access methods, such as BDE and ADO; VCL, Compatible with Delphi 6, 7, C++Builder 6, Borland Delphi Studio , and lookup fields; Local master/detail relationship; Master/detail relationship in CachedUpdates mode.
The included sample applications are fully functional. To use the demos, you have to first set up a connection to a server. You can do so by clicking on the "Connect" button.
Many demos may also use some database objects. If so, they will have two object manipulation buttons, "Create" and "Drop". If your demo requires additional objects, click "Create" to create necessary database objects. When you are done with a demo, click "Drop" to remove all objects used for the demo from your database.
You can modify and execute this script manually, if you like. This will not change the behavior of the demos. Working with components A collection of samples that show how to work with the basic UniDAC components. General demos A collection of samples that show off the UniDAC technology and demonstrate some ways to work with data. The following table describes all demos contained in this project.
Changes the standard UniDAC connect dialog to two custom connect dialogs. The first customized sample dialog is inherited from the TForm class, and the second one is inherited from the default UniDAC connect dialog class. Includes many TUniQuery usage scenarios. Demonstrates how to execute queries, edit data, and export it to XML files, shows how to perform local filtering, demonstrates several different kinds of record locking and refreshing, and working with FetchAll mode.
This is a very good introductory demo. We recommend starting here when first becoming familiar with UniDAC.
Developing applications with Salesforce CRM integration in Delphi
A typical master-detail data browsing form displays the results of a one-to-many relationship, where one DBGrid displays or set of data enabled controls the results of the first or master table. It then tracks a selection in the first DBGrid to filter the results of a second table used to display the details of the selection in the second DBGrid. Wizard simplifies the steps needed to create a tabular or data-entry form by use of an existing database, unfortunately it is designed to use the BDE versions of TTable and TQuery components.
Everything the wizard does, we can do by hand. Since, through this course, we are working with the ADOExpress set of Delphi components, we'll need to set all the components step by step. Firstly we have to make sure that we have two tables in a master-detail relationship. MS Access relationships Our focus will be on the following two tables: Since both tables are Paradox tables, we'll use the code from the previous article to port them to our working aboutdelphi. Notice that when you port those tables to Access both of them have no index or primary key nor are they linked in any way in Access.
The power in a relational database management system such as MS Access comes from its ability to quickly find and bring together information stored in separate tables.
Database Tools > Cross Database Tools > Power Tools. Torry's Delphi Pages
In order for MS Access to work most efficiently, each table in your database should include a field or set of fields that uniquely identifies each individual record stored in the table.
If two tables are liked in a relation of any kind we should set that relation with the MS Access. Customers-Orders relation To set up the relationship, you add the field or fields that make up the primary key on the "one" side of the relationship to the table on the "many" side of the relationship.
In our case, you would add the CustNo field from the Customers table to the Orders table, because one customer has many orders.
Data and Databases
Note that you have to set the CustNo in Customers to be the primary key for the table. When creating a relation between two tables MS Access provides us with the Referential Integrity feature. This feature prevents adding records to a detail table for which there is no matching record in the master table. It will also cause the key fields in the detail table to be changed when the corresponding key fields in the master are changed - this is commonly referred to as a cascading update.
The second options is to enable cascading deletes. This causes the deletion of all the related records in a detail table when the corresponding record in the master table gets deleted. These events occur automatically, requiring no intervention by a Delphi application using these tables.
Now, when we have all the relations set up, we simply link few data components to create a master-detail data browsing Delphi form. Have an empty Delphi form, and just follow the steps: Select the ADO page on the Component palette. Select the Data Access page on the Component palette. Add two TDataSource components to a form. Select Data Controls page on the Component palette.
Place two TDbGrid components on a form. Add two DBNavigator components, too. This will be the master table.