ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV 2024 feature!
Help / WINDEV Tutorial / Tutorial - External database
  • Using data from an external database
  • Overview
  • Creating the project
  • Creating the analysis
  • Generating the analysis
  • Conclusion

Tutorial - External database

Using data from an external database
We will cover the following topics:
  • Creating a project to use an external database.
  • Creating an analysis that uses files from an external database.
Durée de la leçon 40 mn
Overview
This lesson explains how to manipulate SQL databases with WINDEV.
This lesson is intended for users who are familiar with SQL databases. Some operations to perform on the SQL database will not be presented in detail.
To create an application that uses an SQL database, you need to:
  • Create the project linked to the application. This project will group together all the elements of the application (windows, code, queries, reports, etc.).
  • Import the description of SQL data files.
To follow this lesson:
  1. Connect to your SQL server.
  2. Import the SQL script files and the image directory to the SQL server (located in "\Exercises\SQLDatabase\", in the directory that contains the examples of this tutorial) with the available import tools (MySql, Oracle, SQL Server, etc.). The image directory is used to get the images of the Product data file.
  3. Run the SQL script files on the SQL server.
    Remark: The provided SQL scripts run on Oracle only.
Your SQL database is ready for this lesson.
Creating the project
Warning
Caution: The project creation method was simplified in version 2024 Update 2. This page has been adapted to cover the new method.
To create the project:
  1. Open WINDEV and go to the home page (Ctrl + <).
  2. On the home page, click "Create a project" and select "Windows or Linux application". The project creation wizard starts. The different steps of the wizard will help you create your project.
    The information specified in this wizard can be modified later.
  3. The wizard allows you to choose the style book. Select "Eleven".
  4. The wizard prompts you to enter the project name, location and description. In our case, this project will be named "sqldatabase".
  5. Finish the wizard.
  6. In the "New" window, click "Data" and then click "Analysis".
  7. The analysis creation wizard starts.
Creating the analysis
The steps of the analysis creation wizard are as follows:
  1. Specify the analysis name and directory. By default, the analysis name corresponds to the project name and the analysis directory is a ".ana" directory in the project directory. Keep the default parameters.
    Analysis creation wizard
    Proceed to the next step of the wizard.
  2. Next, you can choose the types of databases used by the project. Select OLE DB (or the SQL database used if you own the corresponding Native Connector).
    Remark: Native Connectors are listed first.
    Selecting the type of database
    Proceed to the next step of the wizard.
  3. Select the OLE DB source that corresponds to the type of your database.
    Proceed to the next step of the wizard.
  4. In the following steps, specify the parameters of your OLE DB connection (the same steps apply for a Native Connector):
    • the name of the database server.
    • the username and password.
    • the database name if necessary.
    • the connection name (the caption associated with the connection is optional).
    Go to the next step.
  5. Finish the wizard. The analysis associated with the project is created. The data file creation wizard opens.
In the file creation wizard:
  1. Select "Use the data files from an existing database". Proceed to the next step of the wizard.
  2. Select the type of data to be imported, OLE DB (or the SQL database used if you have the corresponding Native Connector). Proceed to the next step of the wizard.
  3. Select the OLE DB source that corresponds to the type of your database.
    Proceed to the next step of the wizard.
  4. Select the connection used to create the analysis.
    Proceed to the next step of the wizard.
  5. Specify the data access mode.
    Data access mode
    You can:
    • access the data in its current format directly. Only the description of the tables is imported into the analysis. No conversion is required.
    • convert the data to HFSQL Classic.
  6. In our case, choose "Access the data in its current format directly". Go to the next step.
  7. Select the tables (files) to import.
    Selecting tables to import
  8. Validate and end the wizard. The tables are imported and displayed in the data model editor.
The analysis is as follows:
Analysis of this tutorial
Generating the analysis
The generation of the analysis consists in validating the changes made to the analysis (create data files, add or delete items, etc.) and applying them to the entire project (pages, bound controls, reports, etc.).
If changes have been made to the analysis, a generation dialog box appears automatically when the data model editor is closed.
You can also generate the analysis manually. That's what we are going to do.
To generate the analysis:
  1. In the data model editor, on the "Analysis" tab, in the "Analysis" group, click "Generation".
  2. The analysis generation starts automatically.
Conclusion
In this tutorial, we saw how to create a project and an analysis that use an external database.
When the analysis is generated, the data can be manipulated like HFSQL data. There is no difference. You can:
  • Create a full application via the RAD (Rapid Application Development) tool.
  • Create a full custom application.
Table of contents
Minimum version required
  • Version 2024
Comments
Click [Add] to post a comment

Last update: 03/29/2024

Send a report | Local help