Updating database table datagridview

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.

As we'll see in this tutorial, these statements can be created manually or can be automatically generated by the Sql Data Source s Configure Data Source wizard.

Note Since we ve already discussed the inserting, editing, and deleting capabilities of the Grid View, Details View, and Form View controls, this tutorial will focus on configuring the Sql Data Source control to support these operations.

updating database table datagridview-44updating database table datagridview-2updating database table datagridview-72updating database table datagridview-13

Refer back to the Examining the Events Associated with Inserting, Updating, and Deleting tutorial for a more detailed discussion on the chain of events associated with inserting, updating, and deleting from a data Web control.

Figure 2: Select the Delete Query Property from the Properties Window provide a value for this parameter (leave its Parameter source at None ).

Once we add deleting support to the Grid View, the Grid View will automatically supply this parameter value, using the value of its property added, the Grid View s smart tag now contains the Enable Deleting option. As discussed in An Overview of Inserting, Updating, and Deleting, this causes the Grid View to add a Command Field with its .

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.

Leave a Reply