As discussed in An Overview of Inserting, Updating, and Deleting, the Grid View control provides built-in updating and deleting capabilities, while the Details View and Form View controls include inserting support along with editing and deleting functionality.These data modification capabilities can be plugged directly into a data source control without a line of code needing to be written.

Clicking the Edit button turns the Details View into edit mode, which displays each Bound Field whose (the default) as a Text Box, and the Check Box Field as a checkbox.

Figure 9: The Details View s Default Editing Interface (Click to view full-size image) Similarly, you can delete the currently selected product or add a new product to the system.

Recall that to support inserting, updating, and deleting, with the Object Data Source we needed to specify the object layer methods to invoke to perform the insert, update, or delete action.

With the Sql Data Source, we need to provide SQL statements (or stored procedures) to execute.

For now, leave this checkbox unchecked; we'll examine optimistic concurrency with the Sql Data Source control in the next tutorial.

After checking the Generate statements checkbox, click OK to return to the Configure Select Statement screen, then click Next, and then Finish, to complete the Configure Data Source wizard.An Overview of Inserting, Updating, and Deleting examined using the Object Data Source to facilitate inserting, updating, and deleting with the Grid View, Details View, and Form View controls.Alternatively, the Sql Data Source can be used in place of the Object Data Source.Upon completing the wizard, Visual Studio will add Bound Fields to the Details View for the " Delete Command= "DELETE FROM [Products] WHERE [Product ID] = @Product ID" Insert Command= "INSERT INTO [Products] ([Product Name], [Unit Price], [Discontinued]) VALUES (@Product Name, @Unit Price, @Discontinued)" Select Command= "SELECT [Product ID], [Product Name], [Unit Price], [Discontinued] FROM [Products]" Update Command= "UPDATE [Products] SET [Product Name] = @Product Name, [Unit Price] = @Unit Price, [Discontinued] = @Discontinued WHERE [Product ID] = @Product ID".Visit the page in a browser and note the Edit, Delete, and New buttons included in the Details View.To illustrate this, let s take an example from the table and a Grid View that renders this data.