ybase's DataWindow .NET provides a powerful tool for creating data driven applications with capabilities far beyond the native DataGrid. With it, you can develop flexible, high performance, visually appealing applications with very little coding. The native DataWindow properties, events and methods simplify development.This article and the downloadable code
show you how to create a Windows Form with buttons to Retrieve, Add, Delete, Save, Export, Sort, Filter and Print data. You will create three DataWindow objects using Sybase's DataWindow Designer and associate each DataWindow with an SQL Server table. Each data entry form accesses a different table. The code behind each button will work for all three data entry formswithout modificationto illustrate the DataWindow's built-in OOP capabilities. Figure 1
shows the final application.
You will need to download the 60-day evaluation copy of DataWindow .NET from the Sybase site to follow along.
Quick Overview of DataWindows
A DataWindow consists of two components: a DataWindow control and the DataWindow object. The DataWindow control is simple to understand, because it's much like any other Windows control such as a Button or ListBox. The control comes complete with unique properties and events specific to data access and manipulation. After installing DataWindow .NET, you place the control on the form within Visual Studio by using the "Sybase DataWindow" tab on the toolbox (see Figure 2).
Figure 1. The Sample Application: The figure shows the final application in action with a populated DataWindow.
Figure 2. Sybase DataWindow Toolbar Tab: Installing DataWindow .NET adds new tools to a Sybase DataWindow tab in the Visual Studio toolbox.
|Figure 3. DataWindow Relationships: The figure shows the relationship between the DataWindow object, the DataWindow control, and a Windows Form.
In contrast, the DataWindow object is a non-visual component that interacts with the database. You control the database SELECT
, and UPDATE
statements through the DataWindow object's property settings. The DataWindow object controls the display properties of the data, but you can also dynamically alter them in code. The DataWindow object also controls validation rules, default values, and runtime calculations. You create DataWindow objects using the DataWindow Designer tool, which is (currently) external to Visual Studio, although Sybase is planning a future version that will integrate directly into Visual Studio. After creating each DataWindow, you'll set two properties so you can interact with the database via the DataWindow object. Behind the scenes, DataWindow objects reside in .pbl
files that you must deploy with your applications.
Figure 3 shows the relationship between the object (which contains the SQL), the control (which contains events, properties and methods), and the Windows Form.