That s Not ASP

IOTA^_^    

Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 9.  Using Databases with ASP.NET


That's Not ASP!

Today's lesson illustrates two of the greatest improvements of ASP.NET over classic ASP: the DataSet and data binding. The first is somewhat similar to the older Recordset object, but provides much more functionality. It can represent complete sets of data, including relationships between tables and hierarchical data sets.

Data binding allows you to easily display content in your pages. In classic ASP, you had to manually loop through any data store, such as the Recordset shown in the following code snippet:

 <%    Do While Not objRS.EOF       Response.write "<B>" & objRS("FirstName") & " " & _          objRS("LastName") & "</B><BR>" & _          objRS("Address")  & "<BR>" & objRS("City") & _          "<BR>" & objRS("State") &"<BR>"& objRS("Zip") & _          objRS("Phone") & "<P><HR><P>"       objRS.Movenext    Loop %> 

Developers had to build the code to handle the display as well as the HTML for it. Thus, code and UI elements were interspersed together throughout a page, which was prone to error and often led to confusion (this problem was known as spaghetti code).

With data binding and server controls, that is no longer necessary. These controls will automatically loop through any object that can be iterated, such as a DataSet, array, or even other listing server controls! In addition, they provide a plethora of capabilities to control the display of the data.

After you've experienced data binding and the listing server controls, you'll wonder how you ever got by without them! They can easily cut you development time in half, at the same time providing more functionality than with classic ASP.


    IOTA^_^    
    Top


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon

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