![]() Poll the IsCompleted property of the IAsyncResult You can poll the IsCompleted property of the IAsyncResult. ![]() Int rowCount = cmd.EndExecuteNonQuery( res ) This blocks until the command completes. IAsyncResult res = cmd.BeginExecuteNonQuery() The following code is the C# language equivalent: ' This blocks until the command completes. + " SET DepartmentName = 'Engineering'" _ There are four ways to wait for execution to complete:Ĭall EndExecuteNonQuery Calling EndExecuteNonQuery blocks until the command completes. If an error occurs while executing the command, the exception is thrown when the EndExecuteNonQuery method is called. It is an error to call the EndExecuteNonQuery method to end a call to the BeginExecuteReader method, and vice versa. Passed to the EndExecuteNonQuery method must be the same as the one returned from the BeginExecuteNonQuery call that is beingĬompleted. ADO.NET is not thread safe you must ensure that the BeginExecuteNonQuery call has returned. The call must be made after the BeginExecuteNonQueryĬall returns. You must call the EndExecuteNonQuery method once for every BeginExecuteNonQuery call.
0 Comments
Leave a Reply. |