संपादित करें

इसके माध्यम से साझा किया गया


OracleCommand.Cancel Method

Definition

Attempts to cancel the execution of an OracleCommand.

public:
 virtual void Cancel();
public:
 override void Cancel();
public void Cancel ();
public override void Cancel ();
abstract member Cancel : unit -> unit
override this.Cancel : unit -> unit
override this.Cancel : unit -> unit
Public Sub Cancel ()
Public Overrides Sub Cancel ()

Implements

Examples

The following example creates an OracleCommand, executes it, then cancels the execution. To accomplish this, the method is passed a string that is an SQL SELECT statement and a string to use to connect to the database.

public void CreateOracleCommand(string queryString, string connectionString)
{
    using (OracleConnection connection = new OracleConnection(connectionString))
    {
        OracleCommand command = new OracleCommand(queryString, connection);
        command.Connection.Open();
        command.ExecuteReader();
        command.Cancel();
    }
}
Public Sub CreateOracleCommand _
(ByVal queryString As String, ByVal connectionString As String)
    Using connection As New OracleConnection(connectionString)
        Dim command As New OracleCommand(queryString, connection)
        command.Connection.Open()
        command.ExecuteReader()
        command.Cancel()
    End Using
End Sub

Remarks

If there is nothing to cancel, nothing happens. However, if there is a command in process, and the attempt to cancel fails, no exception is generated.

Applies to

See also