Export (0) Print
Expand All

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 _
)
[C#]
public OracleCommand(
   string commandText,
 OracleConnection connection
);
[C++]
public: OracleCommand(
   String* commandText,
 OracleConnection* connection
);
[JScript]
public function OracleCommand(
   commandText : String,
 connection : OracleConnection
);

Parameters

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

Example

[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

[C#] 
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);
}

[C++] 
public:
 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.

Requirements

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

Show:
© 2014 Microsoft