Welcome!

PowerBuilder Authors: Ian Thain, Chris Pollach, Arthur Hefti, Dan Joe Barry, Maureen O'Gara

Related Topics: .NET, PowerBuilder

.NET: Article

Design and Consume DataWindows in Visual Studio 2005

The power of DataWindow technology

This article talks about the ease with which DataWindows can be designed and consumed in a Microsoft Visual Studio 2005 environment. The DataWindow .NET version 2.5 has the infrastructure to support this concept. With the earlier versions of the DataWindow .NET, such as 1.0, 1.5 and 2.0, the .NET developers had to depend on a standalone DataWindow Designer tool to design DataWindows before consuming it in the .NET Windows Form or ASP.NET applications.

What Is a DataWindow?
For readers who are new to the concept of the DataWindow, let me give a brief introduction on what a DataWindow is all about. The readers familiar with DataWindows may skip this section. The DataWindow is a very popular PowerBuilder technology for building data-driven applications. For any data-driven application, the most common activities the developers perform are:

  • Define the data source.
  • Retrieve the data from the data source.
  • Present the data to the application user.
  • Achieve the CRUD (Create, Retrieve, Update, and Delete) functionality.
The beauty of the DataWindow is that the data-driven applications can be created with very minimal coding. DataWindow consists of two parts.
  • DataWindow Object: The metadata describing the data source and presentation information. This is a logical object residing in a .pbl file.
  • DataWindow Control: The visual container for the DataWindow object; the Datastore is the non-visual container for the DataWindow object.
The DataWindow object can be visually created and modified using the graphical DataWindow painter. The available containers of the DataWindow object for the .NET developers are the Windows Form DataWindow component and the Web DataWindow component.

These are available to the .NET developers through Sybase's DataWindow .NET product.

"Create" in the article title would mean how to create the DataWindow object and "Consume" would mean how the created DataWindow object can be consumed in the .NET Windows Form and ASP.NET Web applications, all from within the Visual Studio IDE.

Design DataWindows in Visual Studio
DataWindow Designer Visual Studio Plug-ins
A few new custom Visual Studio plug-ins have been created to provide this facility to the .NET developers. In Visual Studio terms they are called packages. There are four packages distributed as part of the DataWindow .NET 2.5 as shown in Figure 1.

The packages communicate with the PowerBuilder native functionality through an interop layer called the Plugout. This explains a little bit about the DataWindow Designer plug-in architecture. The following provides a single line description of each of the packages. Details of the packages are shown in the next sections.

  • DataWindow Project: Provides functionality to manage DataWindow projects in the Visual Studio Solution explorer.
  • Database Painter: Provides functionality to create database profiles and connections.
  • DataWindow Painter: Provides functionality to visually design DataWindow objects in the Visual Studio environment.
  • Query Painter: Provides functionality to visually design SQL statements in the Visual Studio environment.
DataWindow Project
A new Visual Studio custom project type with the extension (.dwproj) has been created through this module. This provides the developer with the ability to create DataWindow projects, similar to a C# or a VB project in Visual Studio 2005. The blue rectangular box in Figure 2 shows the DataWindow project hosted in the Visual Studio Solution explorer with a list of DataWindow objects and one of them opened up in the DataWindow painter.

The features provided by this project explorer include the following:

  • New or existing .dwproj (DataWindow project) files can be added into the project using Visual Studio's Add New Project or Add Existing Project wizards.
  • New or existing .pbl (PowerBuilder library) files can be added into the project using the custom Add New Library or Add Existing Library wizards.
  • DataWindow and Query objects can be added into the .pbl files using the custom created Add New Entry wizard.
  • Navigate through the pbls, DataWindow objects and query objects.
  • Copy and move the DataWindow and query objects across pbls.
  • Export DataWindow and query objects as special text files (.srd, .srq).
  • Import .srd and .srq files as objects in the project tree.
  • Build the project to generate .pbd for all the pbls in the project.
Database Painter
This module helps the developer create and maintain database profiles and connections, and database schema maintenance including tables, views, and users. The equivalent for this in the Visual Studio world would be the Server Explorer containing the DB connections. The red rectangular box in Figure 3 shows the database painter hosted in the Visual Studio dockable window.

A database connection needs to be defined before the user can start creating DataWindow and query objects. Two predefined database profiles are distributed as part of the DataWindow .NET 2.5 installation so that the users can get started with designing DataWindows straight away. This module supports the DataWindow and Query painters by managing the database connections required by the painters.

Query Painter
This module helps the developer create and edit Query objects. The Query objects are logical objects and reside inside the .pbl files of the DataWindow project. They help design SQL statements in a Visual Designer and can be a source for DataWindow object creation.

DataWindow Painter
This is the heart of the article where I describe the DataWindow object design. The DataWindow project, Database painter, and Query painter are the support modules for the DataWindow painter.

DataWindow objects are created using an "Add New Entry" wizard, invoked from the .pbl node of a DataWindow project as shown in Figure 4.


More Stories By Geogy Zachariah

Geogy Zachariah is a senior software engineer with the PowerBuilder? DataWindow team in Sybase Singapore.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.