Sams Teach Yourself ASP.NET in 21 Days

( 8 )


Sams Teach Yourself ASP.NET in 21 Days, Second Edition offers an approachalbe guide to the latest in Microsoft .NET technologies. The author's example-packed and accessible presentation style helped make the previous edition a success. The book walks the reader through the .NET Framework and teaches techniques needed to program Web applications efficiently. For experienced user of the previous version of ASP, this title will serve as an invaluable "upgrade" tool. After covering Web Forms and Server Controls, the ...

See more details below
Paperback (Subsequent)
$41.81 price
(Save 23%)$54.99 List Price
Other sellers (Paperback)
  • All (31) from $1.99   
  • New (4) from $22.39   
  • Used (27) from $1.99   
Sending request ...


Sams Teach Yourself ASP.NET in 21 Days, Second Edition offers an approachalbe guide to the latest in Microsoft .NET technologies. The author's example-packed and accessible presentation style helped make the previous edition a success. The book walks the reader through the .NET Framework and teaches techniques needed to program Web applications efficiently. For experienced user of the previous version of ASP, this title will serve as an invaluable "upgrade" tool. After covering Web Forms and Server Controls, the author explores at database access with ADO.NET and

Read More Show Less

Product Details

  • ISBN-13: 9780672324451
  • Publisher: Sams
  • Publication date: 8/28/2002
  • Series: Sams Teach Yourself Series
  • Edition description: Subsequent
  • Edition number: 2
  • Pages: 1077
  • Product dimensions: 7.41 (w) x 9.00 (h) x 2.19 (d)

Meet the Author

Chris Payne has had a passion for computers and writing since a youngage. He holds a bachelor of science degree in biomedical engineering fromBoston University. Chris supported himself through college by working as anindependent consultant and by writing technical articles focused on Webdevelopment. Currently making his home in Orlando, Florida with his wife, Chrisis working as a Web developer and continuing his career as an author of bothtechnical and fictional material.

Read More Show Less

Read an Excerpt

Day 9: Using Databases with ASP.NET

Yesterday you learned all about databases—when to use them, how to build them, and best of all, how to access their data from ASP.NET Web pages. However, yesterday's lesson was only a very brief overview of this process. Today, you'll examine using databases with ASP.NET in much greater detail. You 'll also take a look at data binding and the server controls that were skipped over on Day 6, "Learning More About Web Forms." These additional features make ASP.NET very well suited for database-driven applications.

Today's lesson will cover the following:

  • The new DataSet object
  • What data binding is and how it works with ASP.NET
  • Three more ASP.NET server controls: Repeater, DataList, and DataGrid
  • A data binding example

Introduction to Accessing Data from ASP.NET

Data access over the Web has made some major advances in recent years. It's moved from accessing simple text files for small guestbooks to moving large corporations' entire data systems online—some consisting of several terabytes of data. (One terabyte equals approximately 1,000 gigabytes, or 1,000,000 megabytes.) Even stockbrokers and order execution systems have moved online, generating massive amounts of data daily. Luckily, you have ASP.NET to help you with all that!

Traditional ASP pages used ActiveX Data Objects (ADO) to access and modify databases. ADO is a programming interface used to access data. This method was efficient and fairly easy for developers to learn and implement. However, ADO suffered from a dated model for data access with many limitations, such as the inability to transmit data so it is easily and universally accessible. Coupled with the move from standard SQL databases to more distributed types of data (such as XML), Microsoft introduced ADO.NET—the next evolution of ADO.

ADO.NET is a major revision of ADO that enables ASP.NET pages to present data in much more efficient and different ways. For example, it fully embraces XML and is easily able to communicate with any XML-compliant application. ADO.NET offers a lot of exciting new features that will make your life (as a developer) much easier.

ADO.NET is a very large topic, which is why tomorrow's lesson is devoted to it. For now, you just need to know that ASP.NET pages use ADO.NET to communicate with any type of data store. Figure 9.1 depicts the model of data access with ADO.NET and ASP.NET. ADO.NET is completely compatible with OLE DB-compliant data sources, such as SQL or Jet (Microsoft Access's database engine)....

The DataSet

...ADO.NET revolves around the DataSet. This object is a completely new concept that replaces the traditional Recordset in ADO. A Recordset provided methods that allowed you to retrieve and display database rows, or records. A Recordset was very helpful when you needed to return data, but suffered from some limitations. Specifically, its representation of the data was fairly simple: It couldn't contain more than one set of data, and didn't contain information on the relationships between data.

The DataSet is a simple, memory-resident data store that provides a consistent programming model for accessing data, no matter what type of data it contains. Unlike a Recordset, the DataSet contains complete sets of data, including constraints, relationships, and even multiple tables at once. Figure 9.2 shows a high-level view of the DataSet object model....

...Imagine a box with several compartments. In each compartment, you can put any object you like as long as it fits in the box. You can see and manipulate each object in the box— take it out, add more, just look at it, and so on. That's what the DataSet is, essentially.

When you establish a connection to the database, you hand it a box and tell the data store to fill it with some stuff. You can fill it with tables of data, your own data from elsewhere, other objects—any data you like. No matter what objects you put inside, the box will allow you to do the same things with each object, such as view, add, delete, and so on. Oh, and your box is dynamic, so it will expand or shrink depending on how many objects are in it!

Figure 9.2 includes a DataTable object, which represents a single database table. (The DataSet maintains a collection of these tables in the TablesCollection object.) The DataTable completely represents the corresponding table, including its relationships and key constraints. It contains two other collections, Rows and Columns, which represent the data and schema of the tables, respectively.

Now imagine your box again. Each compartment is a DataTable. The box now has an LCD panel on the outside that automatically lists the objects inside it. (Wouldn't that be great for a refrigerator?) Your box is becoming pretty functional! Figure 9.3 illustrates this box object.

The RelationsCollection object allows you to navigate between tables by the relationships defined on them. It's no longer necessary to use complex joins and unions (the old way of relating tables) in your SQL queries because ADO.NET makes it much easier. The actual relationships are represented by DataRelation objects, which contain infor-mation on the two tables being joined, the primary and foreign key relationships, and the name of the relationships.

You can also add relationships using the DataRelation object. ADO.NET automatically enforces key constraints as well—it won't allow you to change one table in a way that would violate the relationship to the other table....

Read More Show Less

Table of Contents

Introduction 1
Week 1 At a Glance 5
Day 1 Getting Started with ASP.NET 7
Day 2 Building ASP.NET Pages 31
Day 3 Using Visual Basic.NET and C# 59
Day 4 Using ASP.NET Objects with C# and VB.NET 105
Day 5 Beginning Web Forms 139
Day 6 Learning More About Web Forms 171
Day 7 Validating ASP.NET Pages 209
Week 2 At a Glance 257
Day 8 Beginning to Build Databases 259
Day 9 Using Databases with ASP.NET 285
Day 10 Communicating with ADO.NET 335
Day 11 Using XML in ASP.NET 381
Day 12 Employing Advanced Data Techniques 417
Day 13 Reading and Writing Files on the Web Server 453
Day 14 Using ASP.NET's Improved Caching Capabilities 489
Week 3 At a Glance 535
Day 15 Using Business Objects 537
Day 16 Creating XML Web Services 569
Day 17 Consuming and Securing XML Web Services 595
Day 18 Configuring and Deploying ASP.NET Applications 625
Day 19 Separating Code from Content 659
Day 20 Debugging ASP.NET Pages 697
Day 21 Securing Your ASP.NET Applications 731
Bonus Day 22 Building a Complete Application 777
Bonus Day 23 Creating Mobile Web Forms 835
App. A: Answers to Quiz Questions 867
App. B Common ASP.NET Mistakes 929
App. C ASP.NET Controls: Properties and Methods 937
App. D ADO.NET Controls: Properties and Methods 971
Index 993
Read More Show Less

Customer Reviews

Average Rating 4.5
( 8 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 8 Customer Reviews
  • Anonymous

    Posted January 11, 2004

    A Great Book, Now and Later

    While the book can be challenging to follow at times, if you just stay the course it all eventually comes together. It was a great book to learn from. It helps you learn the history of the language, where it comes from, and what makes the language so special, along with how to use it effectively. It was a great beginners book that gave me a lot of confidence that I could just go out and start freelance programming afterwards, especially with a software development section (last chapter or two). The best part is that even old programming vets like me can still get good information out of it, and once your done it is an even better reference. Probably the best book there is to get started in writing applications. It will help programming vets and n00bs get the hang of the language in a very fast manner. The only problem I had with the book was that for about 2 chapters in the very middle it gets extremely confusing and wont explain why it does this... You need to just read it and try to understand because a chapter or two later it all comes together.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted November 8, 2002

    Lots of good info, unfortunately its always different

    This book contains lots of good info, unfortunately its always different info. In one chapter it will do things one way while in other chapters it will be done completely different ways. As well, I've found an enormous number of syntax errors in the examples. So many that I cant really trust any of the code in it. The cd doesnt contain the code examples either so it makes me wonder if some of them were ever actually tested on a real machine! I've found many places where the /> method is used to end a tag and then the same tag is ended with </endtag> method. This will not run!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted August 14, 2002

    Great book

    Descibes ASP in a great way .

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted August 13, 2002

    Not Same Old.

    I hate reading programming books. They put me to sleep. However, Chris did a fine job of keeping me awake. Although I found that some of his end-of-chapter exercises were WAY more difficult than they should have been (day 6 you write a fully functional calculator for example) I found this book to be a very easy read. Everything is explained in detail, the code examples (unlike most SAMS books) are accurate and do not require debugging. I found a few spelling errors and a number of gramatical errors, but it's a programming book, not an english essay. Well worth the money if you've never touched ASP.Net before.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted June 30, 2002

    From the Novice to Advanced - A hands on Book.

    This is my forth ASP.NET book. Chris explains things from start to finish in an orderly fashion. The other books that I've read are bits and pieces of codes - jumping from one topic to another without reason, etc. This was the first one that started at one level - then went to the next level in an orderly fashion. Chris explains why he is teaching you ASP.NET in a specific order which makes the whole learning experience better than any book I've read on this subject. Great job Chris! I wish I would have read your book first.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted February 4, 2002

    Great Text Book!!

    I realy like this book!.I mean it.Because first Chris give clear explanation about the subject and second he uses simple language that give a reader like reading a novel. Finally I recommended this book for all of you that want to know what exactly ASP are and does.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted September 7, 2001

    Awesome Reference!

    I have read this book from cover to cover, and it's by far the best '21 Days' book yet! It's got everything you need to understand ASP .Net. The author does a great job of laying out examples, tips and shortcuts. This is the best written technical book I've ever bought!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted November 23, 2009

    No text was provided for this review.

Sort by: Showing all of 8 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)