| only for RuBoard |
Chapter 1 looked at what ASP.NET is, and Chapter 2
In this chapter you learned that the ADO.NET Managed Providers are the bridge from a data store to your data-driven application. The Managed Providers come in two stock flavors: the SQL Managed Provider and the OleDb Managed Provider. The SQL Managed Provider is used to connect directly to a Microsoft SQL Server database (version 7.0 or higher), and bypasses OLEDB to provider better performance. The OleDb Managed Provider is used to connect to non-Microsoft SQL Server databases, such as Access, Oracle, and a host of others.
In this chapter you created connections to a database, built command objects to execute SQL statements on the database, and used the DataReader to iterate through data before binding it to a server control. You also learned about the DataAdapter class; a specific class for bridging between the Web application and the database to return the result set as a DataTable in a DataSet .
Throughout this chapter you built sample Web forms that connected to the database and returned records as either a data stream ( DataReader ), or a DataTable ( DataAdapter ).
By now you should be comfortable with the two Managed Providers and should be ready to start building data-driven Web applications. For the rest of this book you'll be working with both the Managed Providers. You'll be pulling data into an application with the Managed Command or the DataAdapter , and you'll use the DataSet to persist the data, or the DataReader to iterate through the data.
If it felt as though you covered a lot in this chapter, you did. You'll be using it repetitively throughout this book, so don't worry you'll get lots of practice.
| only for RuBoard |
| only for RuBoard |
IN THIS CHAPTER
Setting Up Your Workspace
Getting Data from a Database
The WHERE Clause
The SubQuery
SQL Joins
Sorting Data
Updating Existing Data
Inserting New Data
Deleting Existing Data
Summary
This chapter will go over Structured Query Language, or SQL, which can be pronounced either "ess-cue-ell" or "sequel." Some people insist that it must be called one or the other. I prefer "sequel" because it's one less syllable to say.
SQL was invented by IBM in 1970 and became an ANSI standard in 1986. It's an English-like, nonprocedural language that aids in the definition, manipulation, and administration of data in a relational database management system (RDMS). I'll be going over today's most commonly used statements and clauses when working with SQL in a sub language environment, such as the writing of Web applications. The statements and clauses introduced in this chapter will be used throughout the rest of the book in code examples. This chapter will not make you an expert in SQL, but if you have not used SQL that much it will give you the foundation you need to start building data driven web applications.
All the example code used in this chapter assumes that you have the Northwind database, which is commonly distributed with either Microsoft's SQL Server or Microsoft Access. If you don't have either one on your computer, you can download the Access 2000 Northwind database at http://officeupdate.microsoft.com/2000/downloadDetails/Nwind2K.htm.
In this chapter, you'll learn about the following:
Using the SELECT statement to retrieve data
Using the FROM clause to specify which table to retrieve data
Using the WHERE clause to filter and return specific rows
Using a SubQuery to retrieve a value from a table nested in a different SQL statement
Using SQL Joins to join two tables together into one result set
Sorting data in descending or
Using the
ORDER BY
clause to
Using the
Using the UPDATE clause to update rows
Using the INSERT statement to insert rows
Using the DELETE statement to delete rows
| only for RuBoard |