The Commands sample shows you how to set up column mappings.
Location
You can find the MappingColumns sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
Object PascalDatabaseFireDACSamplesDApt LayerMappingColumns
- Subversion Repository:
- You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
How to Use the Sample
- Navigate to the location given above and open
MappingColumns.dproj
. - Press F9 or choose Run > Run.
- Click on the Use Connection Definition combo box and select an option.
Files
File in Delphi | Contains |
---|---|
MappingColumns.dproj MappingColumns.dpr | The project itself. |
fMappingColumns.pas fMappingColumns.fmx | The main form. |
Implementation
To set up the columns mapping, the sample implements the following steps.
Create table adapter
[crayon-68e5fb7ab687d769837656/]Assign command
[crayon-68e5fb7ab6882616196920/]Set source result set name
[crayon-68e5fb7ab6884436587806/]Set the DatSTable name
Set the DatSTable name where the rows are fetched.
[crayon-68e5fb7ab6885732961166/]Set the UpdateTable name
[crayon-68e5fb7ab6886106890857/]Set the UpdateTable name
[crayon-68e5fb7ab6887334770339/]Setup column mappings
[crayon-68e5fb7ab6888821604048/]Fetch rows
[crayon-68e5fb7ab688a933755094/]Update changes to RDBMS
To append rows, implement the following code:
[crayon-68e5fb7ab688b316880138/]Then, the sample updates the changes to the RDBMS.
[crayon-68e5fb7ab688c026140668/]Please go to the link below if you want to check the original post of Embarcadero for this sample:
http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.MappingColumns_Sample