This documentation is archived and is not being maintained.

OracleCommand Constructor (String, OracleConnection)

.NET Framework 1.1
Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Initializes a new instance of the OracleCommand class with the text of the query and an OracleConnection object.

[Visual Basic]
Public Sub New( _
   ByVal commandText As String, _
   ByVal connection As OracleConnection _
public OracleCommand(
   string commandText,
 OracleConnection connection
public: OracleCommand(
   String* commandText,
 OracleConnection* connection
public function OracleCommand(
   commandText : String,
 connection : OracleConnection


The text of the query.
An OracleConnection object that represents the connection to a database.


[Visual Basic, C#, C++] The following example creates an OracleCommand.

[Visual Basic] 
Public Sub CreateMyOracleCommand()
    Dim myConnection As New OracleConnection _
       ("Data Source=Oracle8i;Integrated Security=yes")
    Dim mySelectQuery As String = _
       "SELECT * FROM Emp ORDER BY EmpNo"
    Dim myCommand As New OracleCommand(mySelectQuery, myConnection)
End Sub

public void CreateMyOracleCommand() 
   OracleConnection myConnection = new OracleConnection("Data Source=Oracle8i;Integrated Security=yes");
   string mySelectQuery = "SELECT * FROM Emp ORDER BY EmpNo";
   OracleCommand myCommand = new OracleCommand(mySelectQuery, myConnection);

 void CreateMyOracleCommand() 
    OracleConnection* myConnection = new OracleConnection(S"Data Source=Oracle8i;Integrated Security=yes");
    String* mySelectQuery = S"SELECT * FROM Emp ORDER BY EmpNo";
    OracleCommand* myCommand = new OracleCommand(mySelectQuery, myConnection);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

OracleCommand Class | OracleCommand Members | System.Data.OracleClient Namespace | OracleCommand Constructor Overload List