System.Data.OleDb Namespace OleDbCommand Class
Cancels the execution of an OleDbCommand.
[ VB ]
NotOverridable Public Sub Cancel ( )
[ C# ]
public void Cancel ( );
[ C++ ]
public: __sealed void Cancel ( );
[ JScript ]
public function Cancel ( );
IDbCommand.Cancel
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.
The following example demonstrates the use of the Cancel method.
void CancelDemo ( string query, string connString ) {
OleDbConnection myConn = new OleDbConnection ( connString );
OleDbCommand myCommand = new OleDbCommand ( query, myConn );
myCommand.Connection.Open ( );
myCommand.ExecuteNonQuery ( );
myCommand.Cancel ( );
}
Public Sub CancelDemo ( query As String, connString As String )
Dim myConn As New OleDbConnection ( connString )
Dim myCommand As New OleDbCommand ( query, myConn )
myCommand.Connection.Open ( )
myCommand.ExecuteNonQuery ( )
myCommand.Cancel ( )
End Sub |
|
C# |
VB |
OleDbCommand Members