| By Geogy Zachariah | Article Rating: |
|
| October 7, 2007 06:45 AM EDT | Reads: |
9,202 |
The presentation styles supported by the DataWindow object are:
- Grid, Tabular, Freeform
- Crosstab, Graph, Group
- Label, N-Up
- Composite,Treeview
NOTE: There is support for a TreeView Web DataWindow in DataWindow .NET 2.5The Data Source supported by the DataWindow object are:
- Database Table using Quick Select, SQL Select, and Query options
- Stored Procedures
- Web Services
- ADO Dataset
NOTE: Web Services is a new feature of the DataWindow .NET 2.5. (Figure 5)
There are certain differences in DataWindow painter between the standalone DataWindow Designer of earlier versions and the DataWindow Designer plug-in hosted in Visual Studio. The plug-in has been modified to fit the Visual Studio 2005 look and feel.
What has changed in terms of look and feel?
- DataWindow object properties are shown in the Visual Studio Properties Window.
- The Graphic objects are shown in the Visual Studio Toolbox.
- A new managed SQL Dialog has been added to edit data source for the DataWindow object.
- All the DataWindow painter-related menus are integrated into the Visual Studio.
- The way in which the DataWindow expression dialog is invoked has been changed to fit the new Properties Window.
Figure 6 highlights some of the changes mentioned above.
The discussion so far has focused on the way in which DataWindow objects can be designed directly in a Visual Studio environment using DataWindow painter. It also touched on the related modules such as the DataWindow project, Database painter, and Query painter. The next section will discuss how this created DataWindow object can be consumed in a .NET Windows and Web application.
A Typical Workflow for Creating and Consuming DataWindow Objects in Visual Studio
- Create a new DataWindow project in the Solution Explorer using the Visual Studio's New Project wizard.
- Create new pbls in the created DataWindow project using the Add New Library wizard.
- Configure the Database connection using the Database Painter.
- Create DataWindow objects inside the pbl through the Add New Entry wizard.
- Edit the created DataWindow object using the DataWindow Painter.
- Create a Windows form application. Drag-and-Drop a DataWindow control on to the form.
- Set the LibraryList and DataWindowObject properties of the DataWindow control. This way you can attach the object to the control.
- Write a few lines of C# or VB code in the Form load event to connect to a database and call the retrieve method of the DataWindow control; now you have your data with the presentation in your .NET Windows application.
- In order to create an ASP .NET Web Form application, drag-and-drop a WebDataWindow control on to the ASP.NET page.
- Import the required pbls into the bin folder of the application.
- Set the LibraryList and DataWindowObject properties of the WebDataWindow control.
- Write a few lines of C# or VB code in the Page load event to connect to a database and call the retrieve method of the WebDataWindow control and now you have your data with the presentation in your ASP.NET Web application.
Steps 1 to 5 are where you Design your DataWindow objects. Steps 6 to 12 are where you consume the DataWindow objects through a DataWindow control or a WebDataWindow control. The next section will talk about consuming DataWindow objects.
Consume DataWindows in Visual Studio
Existing DataWindow .NET users are familiar with consuming DataWindow objects in a .NET Windows or Web application. For the benefit of new users, I want to talk about how to consume DataWindow objects in Visual Studio.
What are the components distributed as part of DataWindow .NET 2.5?
- DataWindow Control: A .NET WinForm control that can host a DataWindow object in a .NET Windows application.
- Datastore object: A non visual container of a DataWindow object in a .NET Windows application.
- Transaction object: An object to manage the database connection and transaction management.
- WebDataWindow Control: An ASP.NET Web control that can host a DataWindow object in an ASP.NET Web application.
Consume a DataWindow Object in a Windows Form Application
Figure 7 says it all in one picture. Let me try to describe it for you so you can understand it better.
- A DataWindow object called griddw1 has been created in Library1.pbl inside a DataWindow project called DWProject1.
- Drag-and-drop the DataWindow control from the toolbox onto the Windows form named Form1.cs of the WindowsApplication1 application.
- Set the LibraryList and DataWindow object properties of the DataWindow control to point to griddw1. This way you have attached the DataWindow object named griddw1 to the DataWindow control named datawindowControl1.
- What C# code do we write to get the data? Very simple.
- Connect to the database using the transaction object.
- Associate the transaction object with the DataWindow control.
- Call the retrieve method of the DataWindow control.
private void Form1_Load(object sender, EventArgs e)
{
this.transaction1.Dbms = Sybase.DataWindow.DbmsType.Odbc;
this.transaction1.DbParameter = "ConnectString='DSN=EAS Demo DB V110 DWD;UID=dba;PWD=sql'";
this.transaction1.Connect();
this.dataWindowControl1.SetTransaction(this.transaction1);
this.dataWindowControl1.Retrieve();
}
Consume a DataWindow Object in an ASP.NET Web Application
We can extend the same to an ASP.NET Web application by using a WebDataWindow control.
Figure 8 shows how to consume DataWindows in a Web application.
- A DataWindow object called griddw1 has been created in Library1.pbl inside a DataWindow project called DWProject1.
- Create a new Web application called WebSite1.
- Import the Library1.pbl into the WebSite1.
- Drag-and drop the WebDataWindow control from the toolbox onto the Web page Default.aspx of the WebSite1 web application.
- Set the LibraryList and DataWindow object properties of the DataWindow control to point to griddw1. This way you have attached the DataWindow object named griddw1 to the WebDataWindow control named WebDataWindowControl1.
- What C# code do we write to get the data? Very simple.
- Connect to the database using the transaction object.
- Associate the transaction object with the WebDataWindow control.
- Call the retrieve method of the WebDataWindow control.
protected void Page_Load(object sender, EventArgs e)
{
// Profile EAS Demo DB V110 DWD
Transaction transaction1 = new Transaction();
transaction1.Dbms = Sybase.DataWindow.DbmsType.Odbc;
transaction1.AutoCommit = false;
transaction1.DbParameter = "ConnectString='DSN=EAS Demo DB
V110 DWD;UID=dba;PWD=sql'";
transaction1.Connect();
WebDataWindowControl1.SetTransaction(transaction1);
WebDataWindowControl1.Retrieve();
transaction1.Disconnect();
}
The above steps try to explain what I have been discussing in this article.
Conclusion
I hope that the message "Design and Consume DataWindows in Visual Studio 2005" has appealed to you readers in some way, to make you think about the power of the DataWindow technology in the .NET world.
Resource
• Sybase: www.sybase.com/products/development/datawindownet.
Published October 7, 2007 Reads 9,202
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Geogy Zachariah
Geogy Zachariah is a senior software engineer with the PowerBuilder? DataWindow team in Sybase Singapore.
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- How PowerBuilder Got Its Groove Back
- The Cloud Has Cross-Border Ambitions
- Ulitzer Names The World's 30 Most Influential Virtualization Bloggers
- Ulitzer Named "New Media" Partner of Greatly Anticipated iStrategy Event in Berlin
- Risks and Enterprise Mobility?
- Steps for Success in Enterprise Mobility?
- Are Mobile Luddites Resisting Mobility?
- The Difference Between Web Hosting and Cloud Computing
- Sybase CTO to Speak at 4th International Cloud Computing Expo
- Why SOA Needs Cloud Computing - Part 1
- Cloud Expo and The End of Tech Recession
- The Transition to Cloud Computing: What Does It Mean For You?
- Five Reasons to Choose a Private Cloud
- Seeding The Cloud: The Future of Data Management
- The Threat Behind the Firewall
- Economy Drives Adoption of Virtual Lab Technology
- Tips for Efficient PaaS Application Design
- A Rules Engine Built in PowerBuilder
- Sybase Named “Silver Sponsor” of iPhone Developer Summit
- Where Are RIA Technologies Headed in 2008?
- PowerBuilder History - How Did It Evolve?
- The Top 250 Players in the Cloud Computing Ecosystem
- Custom Common Dialogs Using SetWindowsHookEx
- DDDW Tips and Tricks
- OLE - Extending the Capabilities of PowerBuilder
- DataWindow.NET How To: Data Entry Form
- Book Excerpt: Sybase Adaptive Server Anywhere
- Sybase ASE 12.5 Performance and Tuning
- Working with SOA & Web Services in PowerBuilder
- Office 2003 Toolbar: A New Look For Your Old PowerBuilder App
- Dynamically Creating DataWindow Objects

































