Access returned tabular data after starting execution of command runs asynchronously - ADO.NET

Q.  What should you do to access the returned tabular data after starting execution of a command that runs asynchronously? (Choose all that apply.)

1. Call the EndExecuteNonQuerymethod.
2. Call the EndExecuteReadermethod.
3. Wait for the StatementCompletedevent to fire and iterate through the DataReader.
4. Wait for the StatementCompletedevent to fire, call the EndExecuteReadermethod, and then iterate through the DataReader.

- Published on 19 Oct 15

a. 1, 2
b. 1, 2, 3
c. 2, 3
d. 2, 4

ANSWER: 2, 4
 

    Discussion

  • Raj   -Posted on 19 Oct 15
    To access the returned tabular data after starting execution of a command that runs asynchronously you should do the following two tasks.
    • Call the EndExecuteReadermethod.
    • Wait for the StatementCompletedevent to fire, call the EndExecuteReadermethod, and then iterate through the DataReader.
    You can execute commands asynchronously. It means execute commands on a separate thread from the rest of your application so users do not have to wait for the command to complete.

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)