In this chapter, you've learned how to provide your users with the ability to update and delete records in ASP.NET and ADO.NET. ADO.NET offers the ability to execute an SQL statement using either a command object, or a combination of a dataset and a data adapter. When using the latter, you can either let it build update and delete commands automatically, or you can provide them for yourself. The data adapter object can examine each record in the dataset, and use the appropriate commands to push any changes to the database. The ASP.NET DataGrid control provides users with the ability to edit records inline. Users can modify or delete records and post those actions back to the database, with ASP.NET then raising events appropriate to the user action. We can then handle each event programmatically on the server to perform the operations requested by the user. In addition, you can validate user input and actions according to business rules. While the DataGrid control doesn't provide easy validation (as some of the other controls do), you can use one of several techniques to ensure that data validation is done before updating the database. |