Chapter 5 Data Binding

 

Overview

Most Web Forms these days are fed by, and feed, databases. By using a database, in fact, Web applications can do virtually everything that traditional Microsoft Windows or smart client applications can do, with the advantage that there is generally no client installation required. Using a traditional Windows application that accesses a database usually requires that some sort of database driver be loaded on the machine accessing the application, in addition to the actual application. For a Web application, any database drivers need only be loaded on the Web server. The client machine accessing a Web application does not need to know anything about the database connection. Web application user interfaces are not as rich as Windows applications, and they require a constant connection, but these are the only significant downsides.

image from book
Creating the Sample Database

The examples in the book will generally use the BikeBlog database. Included with the source for the book is a file named CreateBikeBlog.sql. To create the database from the SQL file, open Microsoft SQL Server Management Studio. Next, right-click the name of any database in Object Explorer, and then click New Query on the context menu, as shown in the following screen shot.

image from book

A new window appears. Point to Open on the File menu, click CreateBikeBlog.sql, and then click OK. The resulting screen looks like this.

image from book

Click Execute, and the database, tables, views, and stored procedures are created, and the tables are populated with some default data.

image from book

When Classic ASP was first introduced, databases were accessed via classic ADO. Microsoft Visual Basic Scripting Edition (VBScript) supported the use of ADO; however, the ASP framework itself offered no special support for data-bound applications. Classic ADO had what amounted to a one-size-fits-all database object, the Recordset. The Recordset object could be connected and disconnected, it could use a server-side or client-side cursor, and dozens of different properties could be set to modify its behavior. However, an individual data source might or might not support any number of these properties, and would generally give no hint that a property setting was being ignored.

Microsoft ASP.NET 1.x was a complete rewrite, with special emphasis on server controls, including several controls that made data binding easier. Microsoft ADO.NET 1.x introduced a totally new model for database access. In contrast to classic ADO, in which all database access was through the Recordset object, ASP.NET introduced several classes that together allowed a developer to do most, but not quite all, of what was possible with classic ADO.ADO.NET added features that gave the developer much greater control over certain aspects of database access.

 


Programming Microsoft Web Forms
Programming Microsoft Web Forms (Pro Developer)
ISBN: 0735621799
EAN: 2147483647
Year: 2005
Pages: 70
Authors: Douglas J. Reilly
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net