If you read Chapter 20, “Database Basics,” you already know that a SQL statement is a type of database command. By using SQL you can query a database, update records, and perform other activities.
→ For more on SQL, see Chapter 20, “Database Basics,” p.535
In this section, we’ll describe how to execute SQL commands using ADO.NET’s connection and command classes.
To get or update data in a database, you have to first connect to the database. Connecting to a database is similar to logging in to your favorite Web site. In ADO.NET, you establish connections using the appropriate connection class. The Open method establishes the connection, and the Close method terminates the connection. While ...