473,729 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginexecuterea der, endexecutereder , executereader

HI all,

Whats the differe between useing Executereader() and
Beginexecuterea der()...endexec utereader() for asyncronys running of a SP

Thanks
Robert
Jul 4 '06 #1
5 6553
Robert Bravery wrote:
HI all,

Whats the differe between useing Executereader() and
Beginexecuterea der()...endexec utereader() for asyncronys running of a SP

Thanks
Robert
The BeginExecuteRea der(...) and EndExecuteReade r...() are for performing the
ExecuteReader(. ..) method asynchronously. If you use ExecuteReader(. ..)
your thread is blocked while that method executes.

Using BeginExecuteRea der(...) (and the corresponding EndExecuteReade r(...))
ExecuteReader(. ..) will be executed in a seperate thread, allowing for
yours to continue processing. The BeginExecuteRea der(...) method will
require a callback method, and in that callback method, you will make a
call to EndExecuteReade r(...) to end the asynchronous operation, and
retreive the return value.

--
Hope this helps,
Tom Spink
Jul 4 '06 #2
Robert,
ExecuteReader is the synchronous version, whereas BeginExecuteRea der and
EndExecuteReade r are the asynchronous counterparts. EndExecuteReade r would be
called in the callback method that BeginExecuteRea der points to, to get your
resultset.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Robert Bravery" wrote:
HI all,

Whats the differe between useing Executereader() and
Beginexecuterea der()...endexec utereader() for asyncronys running of a SP

Thanks
Robert
Jul 4 '06 #3
"Robert Bravery" <me@u.comwrot e:
Whats the differe between useing Executereader() and
Beginexecuterea der()...endexec utereader() 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 BeginExecuteRea der(). 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

--
http://barrkel.blogspot.com/
Jul 4 '06 #4
HI,

Thanks for all the answers, I think I got most of that.
I started a beginexecuterea der, 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 endexecutreread er 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

"Barry Kelly" <ba***********@ gmail.comwrote in message
news:vn******** *************** *********@4ax.c om...
"Robert Bravery" <me@u.comwrot e:
Whats the differe between useing Executereader() and
Beginexecuterea der()...endexec utereader() 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 BeginExecuteRea der(). 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

--
http://barrkel.blogspot.com/

Jul 4 '06 #5
Progress? Easy way, show an animated gif in a picturebox while wating. You
would have to have some intermediate events that you could respond to in
order to be able to show partial progress points, and I don't think there are
any.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Robert Bravery" wrote:
HI,

Thanks for all the answers, I think I got most of that.
I started a beginexecuterea der, 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 endexecutreread er 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

"Barry Kelly" <ba***********@ gmail.comwrote in message
news:vn******** *************** *********@4ax.c om...
"Robert Bravery" <me@u.comwrot e:
Whats the differe between useing Executereader() and
Beginexecuterea der()...endexec utereader() 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 BeginExecuteRea der(). 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

--
http://barrkel.blogspot.com/


Jul 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2529
by: James Hokes | last post by:
Hi All, We're using the 1.1. Framework against SQL Server 2000, and are having a strange issue where we don't get errors back from the stored procedure, i.e. the exception never gets thrown. The scenario is this: 1.) Set up SqlConnection and SqlCommand 2.) Set SqlDataReader equal to the return value from SqlCommand.ExecuteReader
1
25266
by: Mark | last post by:
It appears that you can only retrieve an Output parameter from a SQL Server stored procedure when using the ExecuteNonQuery of the SqlCommand class, and cannot use the ExecuteReader() method. In the code sample below, it bombs on the line with three *** when using the ExecuteReader, but works just fine when you use the ExecuteNonQuery. When using the ExecuteReader, the Output parameter appears to return a value of Null. The stored...
6
8808
by: BuddyWork | last post by:
Does anyone know if there are any articles explaining how I could debug into SqlCommand.ExecuteReader so I can see why I am getting a particular error. thanks
0
1387
by: BuddyWork | last post by:
Hello, The problem is that when using SqlCommand.ExecuteReader and the SQL statement raises an error of severity of 16 then ExecuteReader throws an exception, when you use OdbcCommand.ExecuteReader the exception is not raised but when you call Read() method of the OdbcDataReader you then get the exception which is correct, basically SqlClient does not let you call the Read method, the main problem is that if run a Sql statement of say
5
3106
by: orencs | last post by:
Hello, I am using Microsoft.Practices.EnterpriseLibrary.Data. I am running the following sqlCommand = "SELECT var1 FROM table1 WHERE var2 IN (4,5,6) ; SELECT var3 FROM table2 WHERE var2 IN (4,5,6)"; IDataReader dataReader = db.ExecuteReader(dbCommandWrapper); while
4
4067
by: phil | last post by:
Hi, With the code below, i get the error: ExecuteReader: Connection property has not been initialized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: ExecuteReader: Connection property has not been initialized.
1
4724
by: fniles | last post by:
I am using OLEDBDataReader to read from an Access database. I have 4 data source where I get my data from, and each data source is in its own thread. When receiving data, if it is a new commodity I am need to read from the database. Since I can receive data from different data source at the same time, it is possible that I read from the database at the same time.
7
13583
by: fniles | last post by:
I am using VB.Net 2003 and MS Access (connecting using OleDBConnection). I read using DataAdapter and DataSet, not DataReader. When many people try to access the database at the same time, I get the error "ExecuteReader requires an open and available Connection. The connection's current state is Open, Executing." I do not use ExecuteReader, why the error says ExecuteReader. What does it mean ? When I get this error, is there a way for me...
0
2509
by: =?Utf-8?B?ZGF2ZQ==?= | last post by:
The following finishes in 1 hour instead of erroring after 1 second as expected. Dim cn As New System.Data.SqlClient.SqlConnection cn.ConnectionString = "Server=(local); Database=master; User ID=sa; Password=passwd; Asynchronous Processing=true;" cn.Open() Dim sqlcommand As New System.Data.SqlClient.SqlCommand sqlcommand.Connection = cn
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.