System.Data.Odbc.OdbcCommand Class

Represents an SQL statement or stored procedure to execute against a data source. This class cannot be inherited.

See Also: OdbcCommand Members

Syntax

[System.ComponentModel.DefaultEvent("RecordsAffected")]
[System.ComponentModel.ToolboxItem("System.Drawing.Design.ToolboxItem, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.Designer("Microsoft.VSDesigner.Data.VS.OdbcCommandDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
public sealed class OdbcCommand : System.Data.Common.DbCommand, ICloneable

Remarks

The System.Data.Odbc.OdbcCommand class provides the following methods for executing commands against a data source:

OdbcCommand.ExecuteReader

Executes commands that return rows.

OdbcCommand.ExecuteNonQuery

Executes commands such as SQL INSERT, DELETE, UPDATE, and SET statements.

OdbcCommand.ExecuteScalar

Retrieves a single value, for example, an aggregate value, from a database.

You can reset the OdbcCommand.CommandText property and reuse the System.Data.Odbc.OdbcCommand object. However, you must close the System.Data.Odbc.OdbcDataReader before you can execute a new or previous command.

If execution of the command causes a fatal System.Data.Odbc.OdbcException such as a SQL Server severity level of 20 or more, System.Data.Odbc.OdbcConnection may close. However, the user can reopen the connection and continue.

Requirements

Namespace: System.Data.Odbc
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0