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


Sybase's DataWindow .NET: Way Beyond the .NET DataGrid : Page 2

Sybase's new DataWindow .NET lets you create powerful data-driven applications that provide advanced display and printing capabilities with less programming than ever. If you ever worked with PowerBuilder, you'll know why a .NET version of the DataWindow is such an important addition to your toolset. If not, you'll be surprised at the power of the DataWindow.

Create the DataWindow Object
Figure 4. Database Profiles: The Database profile dialog contains a list of connection methods.
After installing DataWindow .NET, launch the DataWindow Designer from the Windows Start menu. The first step is to identify the database connection to the DataWindow designer, which uses the connection to produce the list of tables and columns to build the visual representation of the DataWindow. I've used SQL Server's pubs database for the example.

From the main menu, select Tools-->Database Profile. You'll see a list of connection methods. The DataWindow supports native access to many databases, as well as ADO and ODBC access. Select "ODB ODBC" from the list for this example (see Figure 4) and then click "New" to create a new data source.

You'll see the Database Profile Setup dialog shown in Figure 5. Enter the logical name mypubs in the "Profile Name" field. You'll use this logical name only within the DataWindow designer.

Figure 5. Database Profile Setup Dialog: The dialog lets you enter connection-specific information to set up a profile.
Select your ODBC named source by clicking the "Data Source" dropdown and select your new data source. For this example, both the profile name and the data source are called myPubs. With the profile dialog still open, click the "Preview" tab. Click "Test Connection" to verify that you've successfully established a connection to your database. Take note of the database connection syntax. You will need to provide that connection string later when you're building the form. Your connection string should look similar to the following:

ConnectString='DSN=myPubs;UID=;PWD=', DelimitIdentifier='No',CommitOnDisconnect='No'

After successfully testing the connection, you will return to the "Database Profiles" dialog (see Figure 4), where the Connect button will be enabled. Click the Connect button to connect to the database. Now you will be able to select any table or stored procedure within the database when you create the DataWindow object.

Creating a Library Project
You must create a library project to hold the DataWindow objects you create. Select File-->New from the menu. You'll see a dialog highlighting the project tab. You are creating a new project, so click the project icon in the tab (see Figure 6).

Figure 6. Library Project: Use the Library Project icon to create a new project.
Figure 7. Saving the Project: The figure shows the new project Save dialog, where you specify a name and location for the new project.
Figure 8. A Blank Project: When you create a new project, you'll see two initial files in the project folder in the DataWindow designer.
Save the project in a folder called myPubsFolder and name the project-library myPubsDataWindow (see Figure 7).

The designer creates two files in the folder. The designer will save all DataWindow objects that you create to the file C:\myPubsFolder\myPubsDataWindow.pbl. You will need to deploy this file with the application. The DataWindow designer now shows the blank project (see Figure 8).

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



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