See Also: OleDbCommand Members
When an instance of System.Data.OleDb.OleDbCommand is created, the read/write properties are set to their initial values. For a list of these values, see the System.Data.OleDb.OleDbCommand constructor.
System.Data.OleDb.OleDbCommand features the following methods executing commands at a data source:
OleDbCommand.ExecuteReader |
Executes commands that return rows. OleDbCommand.ExecuteReader may not have the effect that you want if used to execute commands such as SQL SET statements. |
OleDbCommand.ExecuteNonQuery |
Executes commands such as SQL INSERT, DELETE, UPDATE, and SET statements. |
OleDbCommand.ExecuteScalar |
Retrieves a single value, for example, an aggregate value from a database. |
You can reset the OleDbCommand.CommandText property and reuse the System.Data.OleDb.OleDbCommand object. However, you must close the System.Data.OleDb.OleDbDataReader before you can execute a new or previous command.
If a fatal System.Data.OleDb.OleDbException (for example, a SQL Server severity level of 20 or greater) is generated by the method executing an System.Data.OleDb.OleDbCommand, the System.Data.OleDb.OleDbConnection, the connection may be closed. However, the user can reopen the connection and continue.