Introduction

Introduction
byJohn Kauffman, Fabio Claudio Ferracchiatiet al.?
Wrox Press ?2002

One of the most important requirements for any web site is to accurately and safely transmit and store information. This information could be in any form, from the credit card details stored by a credit company, to the results of a straw poll on a marketing site. Whatever you use ASP.NET web pages for, you'll find that sooner or later you're going to need to access, read from, write to, and generally master operations involving a database.

Luckily for us, working with databases from a web application is much simpler than it used to be. The .NET Framework has revolutionized the way in which we can develop sophisticated web sites. ASP.NET has made enormous improvements to the ways in which we can develop complex and interactive web sites, and ADO.NET - which provides powerful and flexible data processing functionality - has radically changed the ways that we can retrieve, process, and store data from within a web application.

In this book, we're going to explain how to can create data-enabled ASP.NET applications. Written with hands-on learning in mind, it is packed with code examples that demonstrate important fundamental principles. Requiring some basic knowledge of ASP.NET and Visual Basic .NET, but assuming no prior experience of working with databases, the authors will guide you through the processes involved in connecting ASP.NET pages to a database, and investigate the various ways of reading, processing, and updating data. They'll then explore all the major issues involved in data-heavy ASP.NET programming, including some more advanced topics such as using stored procedures and components. The book concludes with a case study that puts everything in the preceding chapters into context.

Revised: 08/19/2002

Note: Access to sample database

A couple of readers have reported difficulty in getting access to the sample Northwind database from their ASP.NET applications. If this is happening to you, take a look at the following file, which should provide the help you need:

Program Files\Microsoft Visual Studio .NET\FrameworkSDK\ Samples\Setup\html\ConfigDetails.htm  

Revised: 11/07/2002

Warning about operating systems 

To use this book, you need a computer running Windows 2000 (any version) or Windows XP Professional Edition. The examples it contains will not run on Windows XP Home Edition.

What Does This Book Cover?

Chapter 1 begins by looking at the general notion of creating data-driven web sites. More specifically, we talk about the relationship between web sites and data, introducing ADO.NET in the process. Later in the chapter, we look at setting up our development environment for the rest of the book, and discuss some of the stumbling blocks that you may encounter.

It seems like a strange question, but what exactly is a database? In Chapter 2 we examine different types of databases, how they are designed, and how we can use them to store and retrieve information. We then move on to present an overview of the SQL language, and draw a quick comparison between Microsoft's database solutions.

Having taken our first look at databases, we need to learn how to connect to them from our ASP.NET code. Chapter 1, clarifying the important terms that you need to know. We then move on to create and test a connection to the sample Northwind database that we'll be using throughout the book. This chapter contains numerous examples that demonstrate how to connect to diverse data sources such as Access, SQL Server, Excel, and XML, enabling us to be confident in whatever environment we have to develop in.

Packed with examples, Chapter 4 looks at reading and displaying data using data reader objects. We start with a discussion of the theory of handling data in ASP.NET and ADO.NET that introduces command objects. After that, we go on to look at how we can use data readers to obtain data, and then bind that data to different controls like radio buttons, check boxes, and most importantly, the DataGrid.

Chapter 5 talks about an important ADO.NET object called DataSet, which is used to store and retrieve data of any complexity on the server. Once the initial theory is dealt with, we use plenty of examples to demonstrate different ways to use a dataset.

Of course, we don't always just read other people's data, so Chapter 6 explains how to create our own records in existing databases. Topics covered in this chapter include ASP.NET's validation controls, and using command and DataSet objects to perform record insertions.

Following on from the previous chapter, Chapter 7 demonstrates how to modify and delete records. We look at how to edit data using the DataGrid and DataView controls, and at how to update and delete records from a dataset object

Next in line is Chapter 8, which looks at stored procedures. In it, we explain what they are, what they can be used for, and some of their advantages and disadvantages. After demonstrating how to create stored procedures with Visual Basic .NET, this chapter shows how to invoke them from your ASP.NET code, and how to supply them with parameters to perform certain tasks.

Chapter 9 is a mine of information regarding some of the more advanced topics that can crop up when you're creating commercial-quality data-driven ASP.NET applications. The four subjects that we introduce and explain here are error handling, code structure, scalability and concurrency, and security.

Approaching the end of the book, Chapter 10 introduces components, explaining why they can be valuable before discussing how to create them. The code samples in this chapter center around the creation of a class library that includes numerous methods for accessing a database.

Since one of the goals of any programmer should be to write the best code possible, Chapter 11 is devoted to performance issues. We look at connection pooling and performance counters, and produce some metrics on the relative performance of dataset and data reader objects in different situations. We also highlight the importance of porting old ADO code to new ADO.NET as soon as you can.

We finish with a case study in Chapter 12. This builds on all the subjects that have been presented in the book, and presents a complete, real-world application that uses multiple ASPX pages, ASP.NET web server controls, VB.NET components, and stored procedures.



Beginning ASP. NET 2.0 and Databases
Beginning ASP.NET 2.0 and Databases (Wrox Beginning Guides)
ISBN: 0471781347
EAN: 2147483647
Year: 2004
Pages: 263

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