NET 2.0 introduced a number of new Web controls designed for accessing and modifying data. In short, with the Data Source controls you can work with data without having to write a lick of data access code. NET 1.x, which required oft-repeated code to access data.
These controls allow page developers to declaratively access and modify data without writing any code to perform the data access. For example, to display the contents of a database table in a web page with ASP. NET 2.0, data can be accessed entirely from declarative markup.
To specify a different ordering, click the ORDER BY button.
Here you can choose what columns the data should be sorted by, and if it should be sorted in ascending or descending order.
Regardless of where your database is located, once you have a database to work with in order to access its contents you'll want to add a Sql Data Source (or Access Data Source) control to the page. The Data Source controls display in the Designer as a little gray box; they do not emit any HTML markup when a browser visits the page.
In order to correctly access data, we must set a variety of Sql Data Source properties that indicate the database to use and the query to execute.
The first screen, shown below, prompts you to select the database from which the data will be queried.
The drop-down list lists existing connection strings defined in the , you have one place to update.Or the data to retrieve might be accessible from a stored procedure.In these cases we must select the "Specify a custom SQL statement of stored procedure" radio button and click Next.While these can be set through the Properties pane, it's usually quicker to use the wizard, which can be reached by clicking on the "Configure Data Source" link in the Sql Data Source control's smart tag.When you click the "Configure Data Source" link a wizard appears, prompting you to select the data to retrieve.The selections here tack on an If you opt to select the columns to return from a table or view you can only configure simple queries that involve a single table or view.