Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Wayfast Datasets allow us to connect a page with a data source like a database or an API. Databases are one of the Wayfast Pillars. Wayfast Application Project’s are mostly used to interact with databases and Datasets are the mean to achieve that goal. As a general rule we suggest using Stored Procedures to interact with databases bug Datasets can run ad-hoc queries too.

...

Today we are going to review how to execute a store procedure for reading data and displaying it in a Grid.

Preconditions

Before we start, this lesson assumes the following preconditions:

  1. We already have a project connected with a database. You can find more details here: Attach or create databases.

  2. We need an active requirement so we can create objects in our database.

  3. This lesson assumes you already know what a stored procedure is. If you don’t you can read about them here.

Step 1: Create database object

...

and update Wayfast DB Model

First let’s connect to the project’s database using SQL Server Management Studio.

...

Once the popup closes all new database objects are available in wayfast.

How to create a new Dataset? (IN REVIEW)

Go to “Project Pages” at the top menu. Select any of the pages available in the project. Then click on “New Dataset” button

...

Now that we have can retrieve data from our DB we need to show it in the Application’s UI.

How to connect a Dataset with a Grid?

Let’s create an example using grid columns linked to the new dataset.

...

All the information in the table is now available in the page. In the following lesson, we are going to analyze how we can insert values on the table using “Actions” feature.

Recap

In the first part, we learnt how Pages interact with database by creating Datasets. Then we made a first approach using SQL to create a simple Stored Procedure that was linked to Dataset. In the second part, we explained how the Controls under pages can display in different ways the information available on database, assigning the place and source. In the next lessons, we will learn how to connect the Controls with Actions that user will have in pages to make the application more dynamic.