Sources of Data and DataSource Controls

It may be of some comfort that the various sources of data your websites can access have not changed. They are:

  • Databases (e.g., SQL Server, Oracle, MySQL)

  • XML documents (e.g., RSS feeds, the metabase for your Internet Information Services [IIS] web server)

  • Business objects

  • Flat files (e.g., IIS logfiles, CSV files, Excel files)

In addition, the various ways provided to bind data to items on a web page remain the same as well. This chapter will concentrate on the numerous data source controls available since ASP.NET 2.0.

Tip

The name generally used to refer to the ways in which you can access and use data in ASP.NET is ADO.NET. The ADO.NET team at Microsoft is responsible for the contents of the System.Data and System.Linq namespaces.

A data source control, which is derived from the System.Web.UI.DataSourceControl class, provides a single object that you can define declaratively (in your web page) or programmatically (in your code-behind file). It will manage internally the connection to the data, its selection, and various options concerning its presentation (such as paging and caching) so that all you need to do is tell a UI control what data source to use and everything else is taken care of. In some cases, the controls also allow you to send changes to that data back to the source from which it came. The entire life cycle of the query to and response from the data source is encapsulated in this one control.

Many data source controls exist for accessing ...

Get Programming ASP.NET 3.5, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.