CreateCommand(String,CommandType) Method
Creates and returns a
OracleCommand object associated with the
OracleConnection, and having the specified command text and command type.
In this sample
OracleCommand object is created. It is automatically associated with
OracleConnection that created it.
|
|---|
public void CreateOracleCommand(string myConnString)
{
OracleConnection oracleConnection = new OracleConnection(myConnString);
OracleCommand oracleCommand = oracleConnection.CreateCommand("INSERT INTO Test.Dept(DeptNo, DName) Values(50, 'DEVELOPMENT')", CommandType.Text);
oracleConnection.Open();
try
{
oracleCommand.ExecuteNonQuery();
}
finally
{
oracleConnection.Close();
}
} |
|
|---|
Public Sub CreateOracleCommand(ByVal myConnString As String)
Dim oracleConnection As New OracleConnection(myConnString)
Dim oracleCommand As OracleCommand = oracleConnection.CreateCommand("INSERT INTO Test.Dept(DeptNo, DName) Values(50, 'DEVELOPMENT')", CommandType.Text)
oracleConnection.Open()
Try
oracleCommand.ExecuteNonQuery()
Finally
oracleConnection.Close()
End Try
End Sub |