RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Sybase DataWindow .NET 2.0—Easy, Powerful, and Flexible : Page 2

Sybase's DataWindow .NET control simplifies and unifies the process of building both Windows and Web reporting and data-entry applications—without compromising your control of either the data or the visual style.

Overview of Building a DataWindow Application
You build Windows Form and Web-based applications the same way, using the following steps:

  • Create a DataWindow library using the data designer. The library holds all reports, graphs, labels, and data entry forms. During development, you save the library as a .PBL file, but you can (and should) compile the library to a .PBD file for distribution with your application.
    Figure 4. Transaction Properties: The figure shows the Properties pane for the Transaction object.
  • Use the data designer to build reports, graphs, labels, and data entry forms. The objects you create using the data designer are referred to as DataWindow objects.
  • Use Visual Studio to add a Transactions object to your form (either Windows or Web Form). The Transaction object, added as a hidden control, contains data connection properties.
  • Use Visual Studio to add a DataWindow control to the form. Use the VS toolbox to add the visible control to you form. The DataWindowControl is a visual data driven control comparable to the data grid, but with many additional features.
  • Set the properties for the Transaction object (see Figure 4).
  • Set the DBParameter property to connect to your database. Figure 4 shows the connection string for SQL Server when using integrated security.
  • Set the Dbms property.
  • Set the properties for the DataWindow control (see Figure 5).
  • Set the library list to your .PBL or .PBD library.
  • Set the DataWindowObject property to the object you created using the data designer.
Figure 5. DataWindow Properties: Here are some of the property settings for the DataWindow control used in the sample application.
Add the lines in your program to retrieve the data:

The first line connects to the database. This command should be issued only once in the entire application.

Using the DataWindow Designer 2.0
You use the data designer to build reports, graphs and data entry forms. The creation process is quick and simple. The designer performs very fast—perhaps no faster than prior releases, but it feels more responsive. Although Sybase does not refer to the Designer interface as a Wizard, most of the process feels like a Wizard.

The designer uses a three-step process for creating a DataWindow object, and walks you through the process.

First, you select the type of DataWindow object you want to create (see Figure 6). Then it prompts you to select the data source (see Figure 7). This new designer version supports ADO Datasets as a data source. Finally, you create the SQL for data retrieval (see Figure 8), using a "query painter," which provides a visual interface including drag-and-drop table and column selections as well as the sort command (ORDER BY clause).

Figure 6. DataWindow Object Types. To create a DataWindow object, first select the type of object you want to create from this dialog.
Figure 7. Selecting a Data Source: During the second step to build a DataWindow object, you select a data source from a set of possible choices.
Figure 8. Query Painter: The DataWindow Designer includes a query painter, that lets you drag and drop database tables and columns from a selected data source.
You can add calculation columns or even manually enter the entire SQL string exactly as you want it. The Wizard-like three-step process makes it easy to create the basic layout for your forms, after which the designer takes on a typical multi-pane interface (see Figure 9). After selecting the object type, the table(s), and the column(s), you have a basic form allowing unlimited customization.

The designer truly shines with customization capabilities. The three major panes let you control the look-and-feel by sliding columns and labels, then setting appropriate properties. You can see real-time changes to the presentation in a preview area.
Figure 9. Multi-pane Interface: After using a Wizard-like interface that aids in specifying an object type, data source, and query, the DataWindow Designer switches to a familiar multi-pane interface for designing data-input forms and reports visually.
One of the designer's strongest features is the ability to create both reports and data entry screens using the same banded-style designer. Developers can set a few simple options to create multi-user aware SQL based data entry forms. Configuring these options in the DataWindow object eliminates the need for programming INSERT, UPDATE, and DELETE SQL statements. Whether generating a report or data entry form, the DataWindow provides WYSIWYG output using one line of programming code:

   // print the contents of the DataWindow 
   // without prompting
   // show the Windows print dialog before printing
The next step is to launch Visual Studio and integrate the reports into your applications.

Author's Note: The data designer is very similar to the designer used in PowerBuilder. PowerBuilder users will find little if any transition required to build reports using the designer. Non-PowerBuilder users will find the interface intuitive and powerful.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date