Hour16.Deleting, Inserting, and Editing Data

Hour 16. Deleting, Inserting, and Editing Data

In this hour, we will cover

  • Configuring the SqlDataSource for updating, inserting, and deleting

  • Learning the basics of the UPDATE, INSERT, and DELETE statements, which are SQL statements for modifying database data

  • Editing and deleting data with the GridView

  • Inserting data with the DetailsView

As we saw in Hour 15, "Displaying Data with the Data Web Controls," the ASP.NET data Web controls make displaying data a breeze. We simply drag a GridView or DetailsView onto an ASP.NET page and bind it to a configured data source control. Although displaying database information on a web page is handy, sometimes we might want to let a user modify the database's contents. For example, in the preceding hour we saw how to show the list of books in the Books database. It might be nice to allow visitors to add their own books to the table or leave comments about a particular book.

In addition to displaying data, the GridView and DetailsView controls can also be used to insert new records and delete and edit the existing data being displayed. Best of all, this can all be accomplished without having to write a single line of source code! These code-free insert, update, and delete capabilities are possible thanks to the power of the data source controls. Just like the data source controls are used to retrieve data, they also can be used to modify data.

We have a lot to cover in this hour. But after you've worked through this hour, you'll be able to display, edit, update, and delete data from a database through an ASP.NET page.

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows