Beginexecutereader, endexecutereder, executereader

  • Thread starter Thread starter Robert Bravery
  • Start date Start date
R

Robert Bravery

HI all,

Whats the differe between useing Executereader() and
Beginexecutereader()...endexecutereader() for asyncronys running of a SP

Thanks
Robert
 
Robert said:
HI all,

Whats the differe between useing Executereader() and
Beginexecutereader()...endexecutereader() for asyncronys running of a SP

Thanks
Robert

The BeginExecuteReader(...) and EndExecuteReader...() are for performing the
ExecuteReader(...) method asynchronously. If you use ExecuteReader(...)
your thread is blocked while that method executes.

Using BeginExecuteReader(...) (and the corresponding EndExecuteReader(...))
ExecuteReader(...) will be executed in a seperate thread, allowing for
yours to continue processing. The BeginExecuteReader(...) method will
require a callback method, and in that callback method, you will make a
call to EndExecuteReader(...) to end the asynchronous operation, and
retreive the return value.
 
Robert,
ExecuteReader is the synchronous version, whereas BeginExecuteReader and
EndExecuteReader are the asynchronous counterparts. EndExecuteReader would be
called in the callback method that BeginExecuteReader points to, to get your
resultset.

Peter
 
Robert Bravery said:
Whats the differe between useing Executereader() and
Beginexecutereader()...endexecutereader() for asyncronys running of a SP

Just to add to what the other folks say: you don't necessarily have to
use a callback with BeginExecuteReader(). You might be using it to get
simple concurrency, to mask latency:

IAR result = Begin...
// do other work
// now ready to pick up where we left off
reader = End...(result)

-- Barry
 
HI,

Thanks for all the answers, I think I got most of that.
I started a beginexecutereader, which makes a call to a SP, which does a
selec tinto, of about 40000 rows.
I notice that the rows are only "saved" once the endexecutrereader is called
and completed.
i can however moce the calling form around and do other things
Is this expected behavious.
I was hoping to show some progress of some kind to the user while the SP is
doing its insert.

Thanks

Robert
 
I am using the BeginExecuteReader and EndExecuteReader to call a long running SP. That SP calls many SPs within it.Every inner Sp returns some outpur to main SP, to application gets the callback after first returns. any solution for that?
 
Back
Top