FireDAC.VSE Demo Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample shows the use of a FireDAC database connection and how to populate a database with data using an XML document.


You can find the Project1 project at:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
    • Object Pascal\Database\FireDAC\Samples\AddOn\VSE\Demo
  • Subversion Repository:
    • You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.


  • The application creates a table (test_vs) and inserts data from an XML document using a FireDAC database connection.

Note: The connection to the database does not require authentication.

How to Use the Sample

  1. Navigate to the location given above and open Project1.dproj.
  2. Press F9 or choose Run > Run.
  3. Click the Button1 button and the grid will be populated with data.
  4. Click the Button1 button again to deactivate the TFDQuery component and stop showing the data.


File Contains


Contains the project itself.


Contains the code of the main form.


Contains the main form and the main code.


Contains the code for the VSE class used for parsing the XML document.


Contains the code for the VSEXML class used for XPath.


  • When the TForm is created, a TFDConnection executes a DROP query against the test_vs table, creates the table, and populates it with data from an XML document.
  • The XML document is written at the beginning of the implementation part in the project.
      <StatusMesg>Order accepted</StatusMesg>
  • The TFDQuery executes a SELECT query against the test_vs table and displays the results in a TDBGrid.
  • The project uses procedures which are found in the FireDAC.Comp.VSE.pas and FireDAC.Comp.VSEXML.pas units to interact with the XML document.
    • In the TForm creation procedure, a TFDVSEXMLManager (the FVS code variable) is instantiated and two TFDVSESchema (the oSch code variable) are created.
    • The two TFDVSESchema variables have the following TFDVSECMLFieldDefs fields: Name, DataType, Size, and XPathExpression. One TFDVSESchema is used for Request and the other one for Response. They are used for parsing the XML document.
    • The FVS Manager also adds a TFDVSESessions to allow the TFDQuery to execute the query.