O'Reilly logo

Essential ADO.NET by Bob Beauchemin

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

3.5. Commands

Data providers implement a Command class, such as SqlCommand or OleDbCommand, to execute action statements and submit queries to the database. This class must implement the IDbCommand interface. You can create the Command instance from a Connection instance using the IDbConnection.CreateCommand method. You can also instantiate it directly using a variety of constructors.

The constructor can specify a command string, or you can set the command string by using the CommandText property. The most useful constructor overloads accept an instance of the correct subclass of Connection. The Connection does not have to be open in order to be used in the Command object's constructor. Note that there is not a constructor that takes a command ...

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