- In this lesson you will learn the following concepts
- Overview
- Creating the project
- Creating the analysis
- Generating the analysis
Appendix 2. Using data from an external database In this lesson you will learn the following concepts - Creating a project.
- Creating an analysis.
This lesson allows you to handle SQL databases with WINDEV. | | |  | Note | 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 all application elements (windows, codes, queries, reports, etc.).
- Import the description of SQL data files.
| | |  | Note | To follow this lesson, you must: - Connect to your SQL server.
- 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.
- 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. |
- To create the project:
- Start WINDEV.
- Go to the WINDEV home page (Ctrl + <).
- In 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.
| | |  | Tip | Tip: To create a project, you can also:- Click
in the quick access buttons. - The new element window appears: click "Project".
|
- The first step of the wizard allows you to select the operating system for which the project is intended. Select "Windows platform" and go to the next step of the wizard ("Next").
- For this lesson, we are going to create a "blank" project. Select "Create a blank project" and go to the next step of the wizard.
- WINDEV then prompts you to enter the platform description. Keep the default options ("64-bit Windows executable" and "Executable with windows"). Go to the next step of the wizard.
- The wizard prompts you to enter the project name, location and description. In our case, this project will be named "sqldatabase".
- The different steps of the wizard appear in the menu on the left. These steps can be clicked directly. Since the other steps in the "Description" are not strictly necessary, you can click "Guidelines" directly.
- This step is used to define the code style. Don't change the suggested options. Go to the next step.
- This step is used to define the style book. Select "Elegant". Go to the next step.
- Click the "Database" step. This step allows you define a database.
- Select "Yes, use an existing database".
Go to the next step.
- Select "Import the description from an existing database".
- The analysis creation wizard starts.
- The steps of the analysis creation wizard are as follows:
- 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. We will keep these default parameters.
Go to the next step of the wizard.
- 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.
Go to the next step of the wizard. - Select the OLE DB source that corresponds to the type of your database.
Go to the next step of the wizard. - 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. - Specify the 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.
- In our case, choose "Access the data in its current format directly". Go to the next step.
- Select the tables (files) to import.
- Validate and end the wizard. The tables are imported and displayed in the data model editor.
- The analysis is as follows:
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:
- In the data model editor, on the "Analysis" tab, in the "Analysis" group, click "Generation".
- The analysis generation is automatically started.
When the analysis is generated, the data can be handled like HFSQL data. There is no difference. You can: - Create a full application via the RAD (Rapid Application Development).
- Create a full custom application. For more details, see "Part 4".
|
|
|
|