You are here: Re: newbe question: need a way to read in large query with .net « MsSQL Server « IT news, forums, messages
Re: newbe question: need a way to read in large query with .net

Posted by Erland Sommarskog on 02/26/07 22:29

(troy@makaro.com) writes:
> Could someone please point me in the right direction on how to read in
> a large query with .net.
>
> I am trying to emulate a legacy database system so I don't know the
> upper bounds of the sql query. An example query would be something
> like:
>
> Select * from invoices where year > 1995
>
> the query must be updatable and only return say 10 to 100 rows at a
> time.
> It should also be forward only and discard rows no longer in use to
> save memory.

It sounds like you should use ExecuteReader and loop through the rows.
That is, do not use DataAdapter.Fill. Furthermore, to make it possible
to update the rows as you have read them in, you need to enable MARS,
Multiple Active Result Sets, which I believe you do in the connection
string.

However, if your plan is to read one row at a time and update back,
I wonder from where you get the information to update. It's much much
efficient to perform the update in the database on all rows in one
go.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация