O'Reilly logo

Special Edition Using Microsoft® Visual Basic® .NET by Jeff Spotts, Brian Siler

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

Executing Database Commands

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.

Connecting to the Database

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 ...

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