Hi,
In order to have my application give the best performance, I'm trying to
design my ASP.NET page where I will only have to populate my DataReader once.
It is a simple application where we accept date range from the user, and any
records in our SQL table, called SHIPMENTS, which has a value in a date
field, called EXPORT_DATE, which falls in that date range will be deleted
from the table. But the user would like to see a preview of the records
which will be deleted before he confirms that they should be deleted. So,
right now, the series of events are:
1. User enters date range and clicks OK.
2. Use DataReader and Command to generate the data which is to be displayed
for the user.
3. User clicks 'confirm' for the records to be deleted.
4. Do Step #2 again to get the data, and then iterate through the DataReader
and execute a stored procedure on each record's key to do the delete and
perform other miscellaneous operations.
Is it really necessary to execute the Command object twice, or can't the
DataReader be stored in memory and be ready and waiting for when we'll need
to access it the second time?
Thanks,
John 7 1118
the preferred approach is to open the connection, execute whatever needs to
be executed and closing the connection.
ie keeping the connection open for the least possible time. The connection
is returned to pool on .close().
The problem with datareader is that it keeps the connection open unless
explicity closed.
if you need to preview the data then you should use a disconnected object ie
get a dataset.
if you want to save the number of queries you do to the database you could
write some funky sql code
say pass the delete stored proc a comma seperate string of all the items
that need to be deleted.
that way you have the connection open for least possible time.
keeping the reader in memory is not advisable and you could run into
connection pooling issues.
--
Regards,
Hermit Dave
( http://hdave.blogspot.com)
"John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message
news:41******** *************** ***********@mic rosoft.com... Hi, In order to have my application give the best performance, I'm trying to design my ASP.NET page where I will only have to populate my DataReader
once. It is a simple application where we accept date range from the user, and
any records in our SQL table, called SHIPMENTS, which has a value in a date field, called EXPORT_DATE, which falls in that date range will be deleted from the table. But the user would like to see a preview of the records which will be deleted before he confirms that they should be deleted. So, right now, the series of events are:
1. User enters date range and clicks OK. 2. Use DataReader and Command to generate the data which is to be
displayed for the user. 3. User clicks 'confirm' for the records to be deleted. 4. Do Step #2 again to get the data, and then iterate through the
DataReader and execute a stored procedure on each record's key to do the delete and perform other miscellaneous operations.
Is it really necessary to execute the Command object twice, or can't the DataReader be stored in memory and be ready and waiting for when we'll
need to access it the second time?
Thanks, John
Dear Hermit,
Thanks for the suggestion; I look into what I can do with DataSets...
Thanks,
John
"Hermit Dave" wrote: the preferred approach is to open the connection, execute whatever needs to be executed and closing the connection. ie keeping the connection open for the least possible time. The connection is returned to pool on .close().
The problem with datareader is that it keeps the connection open unless explicity closed. if you need to preview the data then you should use a disconnected object ie get a dataset. if you want to save the number of queries you do to the database you could write some funky sql code say pass the delete stored proc a comma seperate string of all the items that need to be deleted.
that way you have the connection open for least possible time.
keeping the reader in memory is not advisable and you could run into connection pooling issues.
--
Regards,
Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message news:41******** *************** ***********@mic rosoft.com... Hi, In order to have my application give the best performance, I'm trying to design my ASP.NET page where I will only have to populate my DataReader once. It is a simple application where we accept date range from the user, and any records in our SQL table, called SHIPMENTS, which has a value in a date field, called EXPORT_DATE, which falls in that date range will be deleted from the table. But the user would like to see a preview of the records which will be deleted before he confirms that they should be deleted. So, right now, the series of events are:
1. User enters date range and clicks OK. 2. Use DataReader and Command to generate the data which is to be displayed for the user. 3. User clicks 'confirm' for the records to be deleted. 4. Do Step #2 again to get the data, and then iterate through the DataReader and execute a stored procedure on each record's key to do the delete and perform other miscellaneous operations.
Is it really necessary to execute the Command object twice, or can't the DataReader be stored in memory and be ready and waiting for when we'll need to access it the second time?
Thanks, John
You are welcome. Good luck with that.
--
Regards,
Hermit Dave
( http://hdave.blogspot.com)
"John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message
news:C3******** *************** ***********@mic rosoft.com... Dear Hermit, Thanks for the suggestion; I look into what I can do with DataSets...
Thanks, John
"Hermit Dave" wrote:
the preferred approach is to open the connection, execute whatever needs
to be executed and closing the connection. ie keeping the connection open for the least possible time. The
connection is returned to pool on .close().
The problem with datareader is that it keeps the connection open unless explicity closed. if you need to preview the data then you should use a disconnected
object ie get a dataset. if you want to save the number of queries you do to the database you
could write some funky sql code say pass the delete stored proc a comma seperate string of all the items that need to be deleted.
that way you have the connection open for least possible time.
keeping the reader in memory is not advisable and you could run into connection pooling issues.
--
Regards,
Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message news:41******** *************** ***********@mic rosoft.com... Hi, In order to have my application give the best performance, I'm trying
to design my ASP.NET page where I will only have to populate my
DataReader once. It is a simple application where we accept date range from the user,
and any records in our SQL table, called SHIPMENTS, which has a value in a
date field, called EXPORT_DATE, which falls in that date range will be
deleted from the table. But the user would like to see a preview of the
records which will be deleted before he confirms that they should be deleted.
So, right now, the series of events are:
1. User enters date range and clicks OK. 2. Use DataReader and Command to generate the data which is to be displayed for the user. 3. User clicks 'confirm' for the records to be deleted. 4. Do Step #2 again to get the data, and then iterate through the DataReader and execute a stored procedure on each record's key to do the delete
and perform other miscellaneous operations.
Is it really necessary to execute the Command object twice, or can't
the DataReader be stored in memory and be ready and waiting for when we'll need to access it the second time?
Thanks, John
I tried using a DataSet instead of a DataReader but I'm still running into
the same problem where, when I do a PostBack, the DataSet is re-declared with
"Dim" and the data is lost. Is it necessary to always re-declare the DataSet
object on a PostBack?
Thanks,
John
"Hermit Dave" wrote: You are welcome. Good luck with that.
--
Regards,
Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message news:C3******** *************** ***********@mic rosoft.com... Dear Hermit, Thanks for the suggestion; I look into what I can do with DataSets...
Thanks, John
"Hermit Dave" wrote:
the preferred approach is to open the connection, execute whatever needs to be executed and closing the connection. ie keeping the connection open for the least possible time. The connection is returned to pool on .close().
The problem with datareader is that it keeps the connection open unless explicity closed. if you need to preview the data then you should use a disconnected object ie get a dataset. if you want to save the number of queries you do to the database you could write some funky sql code say pass the delete stored proc a comma seperate string of all the items that need to be deleted.
that way you have the connection open for least possible time.
keeping the reader in memory is not advisable and you could run into connection pooling issues.
--
Regards,
Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message news:41******** *************** ***********@mic rosoft.com... > Hi, > In order to have my application give the best performance, I'm trying to > design my ASP.NET page where I will only have to populate my DataReader once. > It is a simple application where we accept date range from the user, and any > records in our SQL table, called SHIPMENTS, which has a value in a date > field, called EXPORT_DATE, which falls in that date range will be deleted > from the table. But the user would like to see a preview of the records > which will be deleted before he confirms that they should be deleted. So, > right now, the series of events are: > > 1. User enters date range and clicks OK. > 2. Use DataReader and Command to generate the data which is to be displayed > for the user. > 3. User clicks 'confirm' for the records to be deleted. > 4. Do Step #2 again to get the data, and then iterate through the DataReader > and execute a stored procedure on each record's key to do the delete and > perform other miscellaneous operations. > > Is it really necessary to execute the Command object twice, or can't the > DataReader be stored in memory and be ready and waiting for when we'll need > to access it the second time? > > Thanks, > John >
any variable you declare within the codebehind class is released when the
server is done processing.
if the data is a part of datagrid then you should iterate the datagrid
during the postback and then fire away whatever functions you need to call.
yes even the dataset will be released when the page is finish processing. if
you want it in the memory then consider using
A. Session (if the data is user specific)
B Cache or Application (if it is non user specific data)
you could also store the data in viewstate but i would advise it as a large
record would mean a lot of traffic between the client and the server.
--
Regards,
Hermit Dave
( http://hdave.blogspot.com)
"John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message
news:0F******** *************** ***********@mic rosoft.com... I tried using a DataSet instead of a DataReader but I'm still running into the same problem where, when I do a PostBack, the DataSet is re-declared
with "Dim" and the data is lost. Is it necessary to always re-declare the
DataSet object on a PostBack?
Thanks, John
"Hermit Dave" wrote:
You are welcome. Good luck with that.
--
Regards,
Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message news:C3******** *************** ***********@mic rosoft.com... Dear Hermit, Thanks for the suggestion; I look into what I can do with DataSets...
Thanks, John
"Hermit Dave" wrote:
> the preferred approach is to open the connection, execute whatever
needs to > be executed and closing the connection. > ie keeping the connection open for the least possible time. The connection > is returned to pool on .close(). > > The problem with datareader is that it keeps the connection open
unless > explicity closed. > if you need to preview the data then you should use a disconnected object ie > get a dataset. > if you want to save the number of queries you do to the database you could > write some funky sql code > say pass the delete stored proc a comma seperate string of all the
items > that need to be deleted. > > that way you have the connection open for least possible time. > > keeping the reader in memory is not advisable and you could run into > connection pooling issues. > > -- > > Regards, > > Hermit Dave > (http://hdave.blogspot.com) > "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in
message > news:41******** *************** ***********@mic rosoft.com... > > Hi, > > In order to have my application give the best performance, I'm
trying to > > design my ASP.NET page where I will only have to populate my DataReader > once. > > It is a simple application where we accept date range from the
user, and > any > > records in our SQL table, called SHIPMENTS, which has a value in a date > > field, called EXPORT_DATE, which falls in that date range will be deleted > > from the table. But the user would like to see a preview of the records > > which will be deleted before he confirms that they should be
deleted. So, > > right now, the series of events are: > > > > 1. User enters date range and clicks OK. > > 2. Use DataReader and Command to generate the data which is to be > displayed > > for the user. > > 3. User clicks 'confirm' for the records to be deleted. > > 4. Do Step #2 again to get the data, and then iterate through the > DataReader > > and execute a stored procedure on each record's key to do the
delete and > > perform other miscellaneous operations. > > > > Is it really necessary to execute the Command object twice, or can
't the > > DataReader be stored in memory and be ready and waiting for when
we'll > need > > to access it the second time? > > > > Thanks, > > John > > > > >
Dear Hermit,
Thanks again; this particular data the user doesn't need to see, but I'll
just make the DataGrid invisible so that I can still reference it for the
data.
Thanks,
John
"Hermit Dave" wrote: any variable you declare within the codebehind class is released when the server is done processing.
if the data is a part of datagrid then you should iterate the datagrid during the postback and then fire away whatever functions you need to call.
yes even the dataset will be released when the page is finish processing. if you want it in the memory then consider using
A. Session (if the data is user specific)
B Cache or Application (if it is non user specific data)
you could also store the data in viewstate but i would advise it as a large record would mean a lot of traffic between the client and the server.
--
Regards,
Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message news:0F******** *************** ***********@mic rosoft.com... I tried using a DataSet instead of a DataReader but I'm still running into the same problem where, when I do a PostBack, the DataSet is re-declared with "Dim" and the data is lost. Is it necessary to always re-declare the DataSet object on a PostBack?
Thanks, John
"Hermit Dave" wrote:
You are welcome. Good luck with that.
--
Regards,
Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message news:C3******** *************** ***********@mic rosoft.com... > Dear Hermit, > Thanks for the suggestion; I look into what I can do with DataSets... > > Thanks, > John > > "Hermit Dave" wrote: > > > the preferred approach is to open the connection, execute whatever needs to > > be executed and closing the connection. > > ie keeping the connection open for the least possible time. The connection > > is returned to pool on .close(). > > > > The problem with datareader is that it keeps the connection open unless > > explicity closed. > > if you need to preview the data then you should use a disconnected object ie > > get a dataset. > > if you want to save the number of queries you do to the database you could > > write some funky sql code > > say pass the delete stored proc a comma seperate string of all the items > > that need to be deleted. > > > > that way you have the connection open for least possible time. > > > > keeping the reader in memory is not advisable and you could run into > > connection pooling issues. > > > > -- > > > > Regards, > > > > Hermit Dave > > (http://hdave.blogspot.com) > > "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message > > news:41******** *************** ***********@mic rosoft.com... > > > Hi, > > > In order to have my application give the best performance, I'm trying to > > > design my ASP.NET page where I will only have to populate my DataReader > > once. > > > It is a simple application where we accept date range from the user, and > > any > > > records in our SQL table, called SHIPMENTS, which has a value in a date > > > field, called EXPORT_DATE, which falls in that date range will be deleted > > > from the table. But the user would like to see a preview of the records > > > which will be deleted before he confirms that they should be deleted. So, > > > right now, the series of events are: > > > > > > 1. User enters date range and clicks OK. > > > 2. Use DataReader and Command to generate the data which is to be > > displayed > > > for the user. > > > 3. User clicks 'confirm' for the records to be deleted. > > > 4. Do Step #2 again to get the data, and then iterate through the > > DataReader > > > and execute a stored procedure on each record's key to do the delete and > > > perform other miscellaneous operations. > > > > > > Is it really necessary to execute the Command object twice, or can 't the > > > DataReader be stored in memory and be ready and waiting for when we'll > > need > > > to access it the second time? > > > > > > Thanks, > > > John > > > > > > > > >
no problems mate.. good luck with that.
--
Regards,
Hermit Dave
( http://hdave.blogspot.com)
"John Walker" <Jo********@dis cussions.micros oft.com> wrote in message
news:92******** *************** ***********@mic rosoft.com... Dear Hermit, Thanks again; this particular data the user doesn't need to see, but I'll just make the DataGrid invisible so that I can still reference it for the data.
Thanks, John
"Hermit Dave" wrote:
any variable you declare within the codebehind class is released when
the server is done processing.
if the data is a part of datagrid then you should iterate the datagrid during the postback and then fire away whatever functions you need to
call. yes even the dataset will be released when the page is finish
processing. if you want it in the memory then consider using
A. Session (if the data is user specific)
B Cache or Application (if it is non user specific data)
you could also store the data in viewstate but i would advise it as a
large record would mean a lot of traffic between the client and the server.
--
Regards,
Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message news:0F******** *************** ***********@mic rosoft.com... I tried using a DataSet instead of a DataReader but I'm still running
into the same problem where, when I do a PostBack, the DataSet is
re-declared with "Dim" and the data is lost. Is it necessary to always re-declare the DataSet object on a PostBack?
Thanks, John
"Hermit Dave" wrote:
> You are welcome. Good luck with that. > > -- > > Regards, > > Hermit Dave > (http://hdave.blogspot.com) > "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in
message > news:C3******** *************** ***********@mic rosoft.com... > > Dear Hermit, > > Thanks for the suggestion; I look into what I can do with
DataSets... > > > > Thanks, > > John > > > > "Hermit Dave" wrote: > > > > > the preferred approach is to open the connection, execute
whatever needs > to > > > be executed and closing the connection. > > > ie keeping the connection open for the least possible time. The > connection > > > is returned to pool on .close(). > > > > > > The problem with datareader is that it keeps the connection open unless > > > explicity closed. > > > if you need to preview the data then you should use a
disconnected > object ie > > > get a dataset. > > > if you want to save the number of queries you do to the database
you > could > > > write some funky sql code > > > say pass the delete stored proc a comma seperate string of all
the items > > > that need to be deleted. > > > > > > that way you have the connection open for least possible time. > > > > > > keeping the reader in memory is not advisable and you could run
into > > > connection pooling issues. > > > > > > -- > > > > > > Regards, > > > > > > Hermit Dave > > > (http://hdave.blogspot.com) > > > "John Walker" <John Wa****@discussi ons.microsoft.c om> wrote in message > > > news:41******** *************** ***********@mic rosoft.com... > > > > Hi, > > > > In order to have my application give the best performance, I'm trying > to > > > > design my ASP.NET page where I will only have to populate my > DataReader > > > once. > > > > It is a simple application where we accept date range from
the user, > and > > > any > > > > records in our SQL table, called SHIPMENTS, which has a value
in a > date > > > > field, called EXPORT_DATE, which falls in that date range will
be > deleted > > > > from the table. But the user would like to see a preview of
the > records > > > > which will be deleted before he confirms that they should be deleted. > So, > > > > right now, the series of events are: > > > > > > > > 1. User enters date range and clicks OK. > > > > 2. Use DataReader and Command to generate the data which is to
be > > > displayed > > > > for the user. > > > > 3. User clicks 'confirm' for the records to be deleted. > > > > 4. Do Step #2 again to get the data, and then iterate through
the > > > DataReader > > > > and execute a stored procedure on each record's key to do the delete > and > > > > perform other miscellaneous operations. > > > > > > > > Is it really necessary to execute the Command object twice, or
can 't > the > > > > DataReader be stored in memory and be ready and waiting for
when we'll > > > need > > > > to access it the second time? > > > > > > > > Thanks, > > > > John > > > > > > > > > > > > > > > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: harishg2 |
last post by:
Hi,
How to store a variable value for more than one executions.
Ex:
main()
{
int i=0;
i++;
printf("%d",i);
|
by: r1 |
last post by:
I am relatively inexperienced in using delegates and asynchronous
methods. I read several articles, and then I developed my own code
with a mission to improve the performance. Wow! I cannot believe the
difference in speed! However, the asynch operation fails sometimes,
despite of the fact that it works most of the time. I am really at a
loss how to fix this sporadic and erratic behavior.
This is a web application developed with...
|
by: comp.lang.php |
last post by:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw code
instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
|
by: Thomas Neubauer |
last post by:
Hello,
i am learning c# and have created now a simple project that just creates 6
random numbers.
My form includes a button and 6 labels for the random numbers. The program
seems to work correct,
however when after a few button clicks the program crashes.
Does anyone know where the reason could be?
|
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...
| |
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,...
|
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,...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |