This could have been done with the same constructor used for the insert command, with two parameters. It demonstrates that you can change the connection object assigned to a command at any time.
The ExecuteNonQuery method performs the update command.
ExecuteNonQuery方法执行更新命令。
This code is part of the UpdateData method of Listing 1 in the Putting it All Together section later in this lesson.
这些代码是表1UpdateData方法的一部分。我们将在本课后面集中介绍。
Deleting Data
删除数据
You can also delete data using the ExecuteNonQuery method. The following example shows how to delete a record from a data base with the ExecuteNonQuery method: