Data Source and Data Display Controls Part 1. Reference: “ASP.NET 2.0 Illustrated” by Alex Homer and Dave Sussman . -ch3 illustrated book http://www.mediafire.com/? 5kgeryodzgx. Databases and Connections.
“ASP.NET 2.0 Illustrated” by Alex Homer and Dave Sussman.
-ch3 illustrated book
1. In code, you use the ConnectionStrings property of the ConfigurationManager object. For example:
2. Within the markup of ASP.NET pages, you use an expression builder, which is a new feature of ASP.NET 2.0. Expression builders allow you to declaratively access features such as connection strings, application settings, and resources. For example, consider the following code:
You can use this data source control by binding another control, such as a GridView, to it. For example:
Listing 3.1 shows the results of configuring a SqlDataSource control with the wizard.
Filtering is slightly different, in that the SelectCommand is not modified, but a FilterExpression property is added, and FilterParameters is used instead of SelectParameters, as shown in Listing 3.3.
Notice that parameters in the FilterExpression aren\'t explicitly named they are positional.
Like the select features, these can be configured manually or via the wizard.
Once configuration has finished, you\'ll find the commands and parameters set.
For the UpdateCommand there are three parameters: ProductName and UnitPrice, which are updated, and ProductID, which identifies the row to update. Notice that even though these take different actions in the command, the parameters within the UpdateParameters are defined in the same way.