Introduction

A database is an organized collection of data. Many strategies exist for organizing data to facilitate easy access and manipulation. A database management system (DBMS) provides mechanisms for storing, organizing, retrieving and modifying data for many users. Database management systems allow access to and storage of data independently of the internal representation of the data.

Today's most popular database systems are relational databases. A language called SQLpronounced "sequel," or as its individual lettersis the international standard language used almost universally with relational databases to perform queries (i.e., to request information that satisfies given criteria) and to manipulate data. In this book, we pronounce SQL as "sequel."

Some popular relational database management systems (RDBMS) are Microsoft SQL Server, Oracle, Sybase, IBM DB2 and PostgreSQL. We provide URLs for these systems in Section 20.11, Web Resources. MySQL (www.mysql.com) is an increasingly popular open-source RDBMS that can be downloaded and used freely by non-commercial users. You may also be familiar with Microsoft Accessa relational database system that is part of Microsoft Office. In this chapter, we use Microsoft SQL Server 2005 Expressa free version of SQL Server 2005 that is installed when you install Visual C# 2005. We will refer to SQL Server 2005 Express simply as SQL Server from this point forward.

A programming language connects to and interacts with a relational database via a database interfacesoftware that facilitates communication between a database management system and a program. C# programs communicate with databases and manipulate their data through ADO.NET. The current version of ADO.NET is 2.0. Section 20.5 presents an overview of ADO.NET's object model and the relevant namespaces and classes that allow you to work with databases in C#. However, as you will learn in subsequent sections, most of the work required to communicate with a database using ADO.NET 2.0 is performed by the IDE itself. You will work primarily with the IDE's visual programming tools and wizards, which simplify the process of connecting to and manipulating a database. Throughout this chapter, we refer to ADO.NET 2.0 simply as ADO.NET.

This chapter introduces general concepts of relational databases and SQL, then explores ADO.NET and the IDE's tools for accessing data sources. The examples in Sections 20.620.9 demonstrate how to build applications that use databases to store information. In the next two chapters, you will see other practical database applications. Chapter 21, ASP.NET 2.0, Web Forms and Web Controls, presents a Web-based bookstore case study that retrieves user and book information from a database. Chapter 22, Web Services, uses a database to store airline reservation data for a Web service (i.e., a software component that can be accessed remotely over a network).

Категории