Re: Redundant ASP.NET SQL command executions.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Hermit Dave (hermitd.REMOVE_at_CAPS.AND.DOTS.hotmail.com)
Date: 10/07/04


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
> > >
> >
> >
> >


Relevant Pages

  • Re: Redundant ASP.NET SQL command executions.
    ... the preferred approach is to open the connection, execute whatever needs to ... be executed and closing the connection. ... "John Walker" wrote in message ... > design my ASP.NET page where I will only have to populate my DataReader ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Redundant ASP.NET SQL command executions.
    ... "Hermit Dave" wrote: ... > ie keeping the connection open for the least possible time. ... >> design my ASP.NET page where I will only have to populate my DataReader ... >> Is it really necessary to execute the Command object twice, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: better seize excuses now or Sayed will comparatively circulate them for you
    ... inside the atmosphere now, won't respect exports later. ... You won't entitle me functioning next to your ... John until his measure spreads exclusively. ... in connection with Wail's crown. ...
    (sci.crypt)
  • Re: Delayed emails
    ... Well John, we're frighteningly in sync. ... I did just that, bypass the Symantec ... Exchange MVP 2007 ... to analyze why the SMTP connection is not being made? ...
    (microsoft.public.exchange2000.general)
  • Re: "This pretty much says it all"
    ... Well John, it usually isn't as involved as the McDonald's graphic ... on my Lenovo X, it is on the left side. ... go through the connection routine ... ... finally reach the 'Free WiFi' host's splash screen in IE to ...
    (comp.sys.mac.advocacy)