Re: Redundant ASP.NET SQL command executions.
From: Hermit Dave (hermitd.REMOVE_at_CAPS.AND.DOTS.hotmail.com)
Date: 10/07/04
- Next message: sck10: "GridView Formatting"
- Previous message: Martin: "Re: asp.net web farm configuration - (cookie domains?)"
- In reply to: John Walker: "Re: Redundant ASP.NET SQL command executions."
- Next in thread: John Walker: "Re: Redundant ASP.NET SQL command executions."
- Reply: John Walker: "Re: Redundant ASP.NET SQL command executions."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 7 Oct 2004 22:23:43 +0100
You are welcome. Good luck with that.
-- Regards, Hermit Dave (http://hdave.blogspot.com) "John Walker" <John Walker@discussions.microsoft.com> wrote in message news:C3378802-E546-49C1-99A0-51C9AAD5E4AB@microsoft.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 Walker@discussions.microsoft.com> wrote in message > > news:41D6A9EF-6AAD-4E79-BD27-4F238325BE01@microsoft.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 > > > > > > > > >
- Next message: sck10: "GridView Formatting"
- Previous message: Martin: "Re: asp.net web farm configuration - (cookie domains?)"
- In reply to: John Walker: "Re: Redundant ASP.NET SQL command executions."
- Next in thread: John Walker: "Re: Redundant ASP.NET SQL command executions."
- Reply: John Walker: "Re: Redundant ASP.NET SQL command executions."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|