Replicate Identity Columns

Updating an identity column

After updating the data, the GridView is returned to its pre-editing state. To illustrate the GridView's editing capabilities, let's step through the editing process from the end user's perspective. We'll examine how to do this in a future installment of this series. The CommandField is a column that shows Edit-related or Delete-related buttons, depending on its property settings. Note If the value in the identity column is set to decrement rather than increment, record the lowest value found, and then reseed with that value.

We'll see how to accomplish this in a future installment as well. Solution The first approach that may come to mind is to add an identity column to your table if the table does not already have an identity column.

You might think

With the update approach you could do this over and over again by just rerunning the query and changing the values. When a particular record in the grid is edited, the GridView's columns switch to their editing interface. Next Steps If you have the need to add a new sequential value to your tables or have the need to update an existing value in a sequential manner don't forget about this approach. The BoundField has a property named ReadOnly.

To see why, try editing a record and changing its category. This is because there is no CategoryName parameter in the SqlDataSource and because the Products database table doesn't even have a CategoryName column, as it comes from the Categories table. Refer to Oracle Database Reference for more information. You can specify only one identity column per table.

The column must also be large

Replicate Identity Columns

The column must also be large enough to hold this expression. You might think that you could just change the CategoryName value. InsertParameters - information about the parameters used in the InsertCommand. In some cases, however, you might only want to let the user edit a subset of the fields that are displayed. Possible Duplicate Values Two of our readers Tillman Dickson and Steve Ash have noted that they have run into an issue where duplicate values are created if this processs is run in parallel.

Both examples use the Northwind database and insert records into the Products table. Oracle recommends that you use a strong encryption algorithm on identity columns.

We'll see how to

The Edit button disappears and in its place Update and Cancel buttons appear. Conclusion In this article we looked at how to use the SqlDataSource and GridView controls to update data from a database. InsertCommand - the text of the command to execute. This displays a column of Edit buttons.

Solution The first