Represents an SQL statement or stored procedure to execute against a database. This class cannot be inherited.
Assembly: System.Data.OracleClient (in System.Data.OracleClient.dll)
The class provides the following methods for executing commands against a data source:
Executes commands that return rows.
Executes an SQL statement against the Connection and returns the number of rows affected.
Executes commands such as SQL INSERT, DELETE, UPDATE, and SET statements.
Retrieves a single value (for example, an aggregate value) from a database as a .NET Framework data type.
Retrieves a single value (for example, an aggregate value) from a database as an Oracle-specific data type.
You can reset the CommandText property and reuse the object.
Unlike the Command object in the other .NET Framework data providers (SQL Server, OLE DB, and ODBC), the object does not support a CommandTimeout property. Setting a command timeout has no effect and the value returned is always zero.
Public Sub ReadMyData(ByVal connectionString As String) Dim queryString As String = "SELECT EmpNo, DeptNo FROM Scott.Emp" Using connection As New OracleConnection(connectionString) Dim command As New OracleCommand(queryString, connection) connection.Open() Dim reader As OracleDataReader = command.ExecuteReader() Try While reader.Read() Console.WriteLine(reader.GetInt32(0) & ", " _ & reader.GetInt32(1)) End While Finally ' always call Close when done reading. reader.Close() End Try End Using End Sub
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.