CreateCommand(String) Method
Creates and returns a
OracleCommand object associated with the
OracleConnection, and having the specified command text.
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')");
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')")
oracleConnection.Open()
Try
oracleCommand.ExecuteNonQuery()
Finally
oracleConnection.Close()
End Try
End Sub |