Summary


In this hour we discussed the ASP.NET data source controls, focusing specifically on the SqlDataSource control, which is designed to retrieve data from a database. The SqlDataSource control needs two bits of information to be able to grab data from a database: information on how to connect to the database and the SQL query to execute. As we saw in the "Working with the SqlDataSource Control" section, the SqlDataSource control contains a wizard that makes specifying this information a breeze.

The SqlDataSource control's wizard eventually generates a SQL SELECT statement that specifies what data to retrieve from the underlying database. This query is written using the Structured Query Language, or SQL, which is the language used by all modern databases for retrieving, inserting, updating, and deleting data.

To retrieve rows from a database table, a SELECT statement is used, which has the syntax

SELECT Column1, Column2, ..., ColumnN FROM TableName WHERE whereConditions ORDER BY ColumnName 


where the WHERE and ORDER BY clauses are optional.

Fortunately, we do not have to be SQL aficionados to retrieve database data in an ASP.NET web page. The SqlDataSource control's wizard allows us to construct our queries through an easy-to-use graphical interface.

Now that we have examined how to retrieve data from a database using the ASP.NET SqlDataSource control, the next step is to display that data in an ASP.NET page. This is accomplished through the use of data Web controls, which are examined in depth in the next hour.




Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

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