Ready to get started?

Learn more about the CData FireDAC Components for Sage 50 UK or download a free trial:

Download Now

Build a Simple VCL Application for Sage 50 UK Data

How to build a simple VCL Application to view Sage 50 UK data in RAD Studio using the CData FireDAC Components for Sage 50 UK.

Embarcadero RAD Studio provides a development environment for Delphi and C++Builder applications. With the CData FireDAC Components for Sage 50 UK, you gain access to live Sage 50 UK data within RAD Studio, abstracting the data into tables, views, and stored procedures that can be used to both retrieve and update Sage 50 UK data. This article will walk through connecting to Sage 50 UK and creating a simple VCL application with the Form Designer.

Creating a VCL Application for Sage 50 UK Data

The following instructions show how to use the Form Designer to create a simple VCL Forms application that shows the basic FireDAC objects needed to connect to Sage 50 UK from any application.

The following example populates a TDBGrid control.

  1. Create a new VCL Forms Application.
  2. Drop a TFDPhysSage50UKDriverLink and TFDConnection object onto the form.
  3. Double-click the TFDConnection object. The FireDAC Connection Editor is displayed. Select "CData.Sage50UK" in the DriverId menu and configure the connection properties.

    Note: Only Sage 50 UK 2012 and above are supported.

    The User and Password properties, under the Connection section, must be set to valid Sage 50 UK user credentials. These values will be the same used to log in to the Sage 50 UK software.

    Additionally, the URL property, under the Connection section, will need to be set to the address of the company dataset desired. To obtain the address, do the following:

    1. If you have not already done so, open the Sage 50 UK software.
    2. Click Tools -> Internet Options.
    3. Select the SData Settings tab.
    4. Click the Details button next to Sage 50 Accounts. A window is displayed containing a list of company names along with the address to their corresponding datasets.
    5. Set the URL property to the value in the address field next to the company desired.

  4. Drop a TFDQuery object onto the form and set the properties below:

    • Connection - Set this property to the TFDConnection object, if this object is not already specified.
    • SQL - Click the button in the SQL property and enter a query.
    • Active - Set this property to true.
  5. Drop a TDataSource object onto the form and set the following property:

    • DataSet - In the menu for this property, select the name of the TFDQuery object.
  6. Drop a TDBGrid control onto the form and set the following property:

    • DataSource - Select the name of the TDataSource.
  7. Drop a TFDGUIxWaitCursor onto the form. This is required to avoid a run-time error.

You now have an executable application that displays the results of the SQL Query set in the TFDQuery object.

 
 
ダウンロード