Interacting with Databases
(Page 1 of 4 )
This article, the first of three parts, explains how to link your ASP.NET web pages with your own database by using the ADO.NET connection, as well as how to write SQL statements in a query that direct the DBMS to perform common tasks. It is excerpted from chapter 10 of
ASP.NET 2.0 DeMYSTiFieD, written by Jim Keogh (McGraw-Hill/Osborne; ISBN: 0072261412).
Whenever you log into your favorite e-commerce web site, you set off a series of routines behind the scenes that, among other things, links the web site with a database that contains product information and probably information about you.
You too can link your ASP.NET web pages with your own database by using the ADO.NET connection. Think of ADO.NET as your pipeline into popular commercial database management software (DBMS) such as Microsoft SQL Server, the Oracle database server, and Microsoft Access.
In this chapter you’ll learn how to make this connection and how to write SQL statements in a query that direct the DBMS to perform tasks that are commonly used in many commercial web sites.
The ADO.NET Connection
Customer data and other information that is typically used by an ASP.NET web page are stored in a database that is managed by database management software (DBMS). As you remember from the preceding chapter, a DBMS such as Microsoft SQL Server, the Oracle database server, or Microsoft Access is a filing cabinet and file clerk all rolled up into one and maintains and accesses data as requested.
Your application interacts with a DBMS by sending it queries using the Structured Query Language (SQL). For example, if you wanted to retrieve a customer’s account information, you’d write an SQL query and send it to the DBMS. The DBMS locates and returns the account information to your application.
However, before you can send the query, you need to connect your application to the DBMS. You do this by using classes provided by ADO.NET. ADO.NET is part of the .NET framework. Although this sounds imposing, it really isn’t.
As you’ll recall from Chapter 2, an object is a real thing that is described by a class definition. In the case of ADO.NET, these objects are database-related “things” such as rows, columns, tables, and databases. ADO.NET contains class definitions that are used to access a database. Remember that a class contains functions and attributes. A function is a block of code that is executed by calling the name of the function. An attribute is data associated with the class.
Therefore, ADO.NET contains code that you call within your application to connect your application to a DBMS and enables your application to send queries to and receive data from a DBMS.
Next: Namespaces and Classes >>
More ASP.NET Articles
More By McGraw-Hill/Osborne
|
This article is excerpted from chapter 10 of ASP.NET 2.0 DeMYSTiFieD, written by Jim Keogh (McGraw-Hill/Osborne; ISBN: 0072261412). Check it out today at your favorite bookstore. Buy this book now.
|
|