Data Source Controls

Among the dozens of new Web Forms controls in ASP.NET 2.0, some of the most powerful are those that let you easily enable your Web applications to access data sources without any coding. Data access in ASP.NET is now performed declaratively using data source controls such as SqlDataSource, XmlDataSource, and AccessDataSource. These controls on a page enable you to bind to data while encapsulating connections, query commands, and parameters into a single control – often with no coding at all on your part. The data source controls work with a variety of back-end data sources, including Microsoft SQL Server, Microsoft Access, XML files, Web services, FrontPage site maps, and business objects that return data sets.

Support for new data backend storage providers can be easily added by implementing custom data source controls. Additionally, the SqlDataSource control that ships in the box has built-in support for any ADO.NET managed provider that implements the new provider factory model in ADO.NET. Of course, if required, you may always access the lower-level ADO.NET data objects in lieu of the provided data source controls.

Use a data source control such as SqlDataSource to bind to your data, then a data display control such as GridView can use the source control itself as its data source. No coding needed.