O'Reilly logo

Sams Teach Yourself ADO.NET in 24 Hours by Paul Bertucci, Jason Lefebvre

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hour 7. Modifying Database Data

As you saw in the preceding hour, the Command object is used in conjunction with the DataAdapter object to retrieve records from your data source and place them into a DataSet, which can then be displayed or manipulated. However, suppose you want to insert data, delete data, or perform any other valid action on the database that doesn't return any records. For this, you can use the ExecuteNonQuery() method of the Command object.

The ExecuteNonQuery() method executes a SQL statement against your data source. In this hour you'll see how to apply the SQL statements from Hour 3, “Using T-SQL: A Crash Course,” to

  • Insert new data into the database

  • Delete data from the database

  • Modify data in the database

The examples in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required